PDA

Click to See Complete Forum and Search --> : VB.NET Winsock Client/Server Data sending Problem


danishce
May 25th, 2007, 06:55 AM
Hello All:
I am developing a client/server application using vb.net winsock programming.
I am sending data to Server and at the same time receive the incoming data from the server.
My application have 3 Windows Forms.
1-FrmInquiry
2-FrmSale
3-FrmBalance
When i send and receive data from FrmInquiry to server it works fine but
My problem is when i go to any other form(ex FrmSale) from FrmInquiry and send data from it to server, it gives error.
but When i run the form FrmSale directly it works fine.
I tried it through Closing socket at Form Unload and initialize its port and IP settings again but no luck.any suggestion?
Another thing is when i close the server & client application and then run it again the FrmInquiry form send data successfully
but again it gives error when i goto FrmSale Form.
How can i send data from one form to another
My code is:

//code for FrmInquiry Form in Load event
tcpclient.remoteport=3000
tcpclient.remotehost="192.168.0.10"
tcpclient.connect
tcpclient.senddata("salman")
dim obj as new FrmSale
obj.show
me.hide

//Code for FrmSale Form in Load event
tcpclient.remoteport=3000
tcpclient.remotehost="192.168.0.10"
tcpclient.connect
tcpclient.senddata("salman")
dim obj as new FrmSale
obj.show
me.hide

//code for frmServer Form in Load event
tcpserver.localport=3000
tcpserver.listen

//Accept connection request
//Get incomng request from client

Regards:
Danish Majid