PDA

Click to See Complete Forum and Search --> : Reliable Communication Between PC


kmchong
Jun 25th, 1999, 09:02 AM
I need to send and receive text strings (length up to 10K) to and from, between 2 PC. I tried using 3 party winsocket components etc, and faced with several problems:
1. Typically, the communication is async, what I need is a sync communication, ie, if machine X sent message to machine Y, then X has to stop processing until Y send result back
2. Even text string is returned from another machine, people told me that the result may be partial string only (I don't know why), is there any way to make sure that the returning message is complete, if not complete, is there any way to signal an error.

atomsheep
Jun 27th, 1999, 11:51 AM
first of all, the winsock control, under the TCP protocol, strives to ensure that the data is transmitted fully and flawlessly. so, there should be no corruption of the sent data along the network, especially with data sizes of less than 10k.

secondly, in the dataArrival event of your winsock control(s), you can set a public property/variable to TRUE when the event is triggered by an incoming event. you can then, in your code, say that when this variable is set to TRUE, then don't send the data yet. when the data has been fully sent over, then some other event will be triggered - i forget which (you can check this up in the vb documentation and online help). all you have to do now is to set that variable to equal FALSE, and now when you want to send data, you know that data is not currently being received, and so can send away.

Darkstar
Jul 5th, 1999, 11:03 AM
Ok, make a global variable to contain the return string, then use this very simple code to hold your app until it has recieved a response

do while Response = ""
doevents
loop

'I know that this isn't all that you need, but it's better than nothing :)