Page 1 of 1

SendNetworkString then delay then SendNetworkFile problem

Posted: Sat Feb 04, 2006 1:56 pm
by zekitez@lycos.com
SendNetworkString and SendNetworkFile
ReceiveNetworkData and ReceiveNetworkFile

I am trying to set up a client/server exchange file protocol using
SendNetworkString SendNetworkFile, ReceiveNetworkData and ReceiveNetworkFile.

First I send a string containing the file name using SendNetworkString
followed by sending the file using SendNetworkFile.
This only works (receiver and client run on the same computer) if I use a delay between SendNetworkString and SendNetworkFile
otherwise the receiver side receives the string, some network data and the first part of the file together
in one buffer (using ReceiveNetworkData).
Is there a way to force "send the network buffer" now instead of the delay ?

Code: Select all

         SendNetworkString(ClientID, SendString$)
         Delay(20)
         SendNetworkFile(ClientID, File$)  

Frans

Posted: Sat Feb 04, 2006 2:08 pm
by Tranquil
Networking is not as easy as it seems. I would advice only to use sendnetworkdata() instead of file or string.

take a look on the forum and search for "correctly networking" you will find some sources how to send/ receives files and strings correctly.

Re: SendNetworkString then delay then SendNetworkFile proble

Posted: Sat Apr 08, 2006 2:11 pm
by zekitez@lycos.com
I managed to get it working in PB4.

1st I added a header and 2nd some kind of receiver tell back.
Found some code of LARS which added #PB_NetworkEvent_Disconnect to the NetworkClientEvent.

Anybody who wants to have a look:
http://home.wanadoo.nl/f.nijhuis/clientserver.zip