connect receiver when need to send message!!
i got one chat system, when i want send message to receiver, i will start connect to the receiver side...after connected and send out first message, when i want send the message, i connect again to the receiver side and this time i couldnt done job because occur some error.....i know that is bcoz of i connect another time...but i want maintain my idea and everytime i want send message then i connect to receiver side....how to solve this problem?
in receiver side, everytime it receive message, it will disconnect the connection and listen connection again....this idea is it not workable?
Re: connect receiver when need to send message!!
As I understand u must be probably using TCP protocol from the WinSock OCX...
I did the same thing once... But the problem is, it takes a little while to make the connection to the destination....
So I suggest u try the following code...
VB Code:
Do Until sck_Connection.State = sckConnected ' sck_Connection is the name of the WinSock control in your Project
DoEvents
Loop
and after the loop terminates try sending ur Message...
Also make sure to terminate the connection from the sender side after the message is sent... :thumb: