SendNetworkString then delay then SendNetworkFile problem

Just starting out? Need help? Post your questions and find answers here.
User avatar
zekitez@lycos.com
User
User
Posts: 15
Joined: Fri Nov 11, 2005 5:42 pm
Location: Netherlands
Contact:

SendNetworkString then delay then SendNetworkFile problem

Post 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
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post 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.
Tranquil
User avatar
zekitez@lycos.com
User
User
Posts: 15
Joined: Fri Nov 11, 2005 5:42 pm
Location: Netherlands
Contact:

Re: SendNetworkString then delay then SendNetworkFile proble

Post 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
Post Reply