VB.NET Winsock Client/Server Data sending Problem

danishce

Member
Joined
Apr 2, 2007
Messages
15
Programming Experience
3-5
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.
My code is:

//code for FrmInquiry Form in Load event
VB.NET:
	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
VB.NET:
	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
VB.NET:
	tcpserver.localport=3000
	tcpserver.listen

//Accept connection request
//Get incoming data from client

Regards:
Danish Majid
 
Back
Top