TCP stream hangs?

BlitzMax Forums/BlitzMax Beginners Area/TCP stream hangs?

LAB[au](Posted 2006) [#1]
Hello,

I am opening a stream to a tcp address/port, this way :

box_socket = CreateTCPSocket()
box_TCP=CreateSocketStream(box_socket)
ConnectSocket(box_socket,HostIp("192.168.1.77"),777)

Then I writebyte to it each frame, sharing the state of my app with the remote box... but whenever I reach approx. 8000 bytes written to it, bmax is throwing a "error writing to stream". The only way to avoid it is to recreate the stream from zero (freeing it before off course).

Should I create the stream each frame and close it after having writen to it?

All I want is a simple way of sending TCP messages to a remote LAN box.

Thanks for your help.


ICECAP(Posted 2006) [#2]
I had a similar problem with Blitz3D, the way i fixed it was indeed opening and closing the stream every time i wanted to send information.
I would suggest not sending data every frame tho, you will still experience some lag because of the cued packets...
Insted try sending ever second, this is how i created an internet and lan playable racing game...
Hope that helps.

Ian


tonyg(Posted 2006) [#3]
Does it happen if define box_socket as TSocket and box_TCP as TSocketstream?
I used the code here for 21mb files (it doesn't use writebyte but is a lot quicker).


LAB[au](Posted 2006) [#4]
Hello, thanks for the suggestions

Icecap: my app is running at 20 fps, and I need this speed, which should not be a problem since it consumes far less bandwidth than available on a lan. I tried with opening/closing the stream but this doesn't seem to make any difference.

tonyg: box_socket is defined as a tsocket and box_TCP as a tstream (as globals) before the actual initialisation.


LAB[au](Posted 2006) [#5]
And adding, that this doesn't happen with blitz3D version of the same app, so network and receiving box are not part of the problem ...


tonyg(Posted 2006) [#6]
... and my code from that link didn't work either?


LAB[au](Posted 2006) [#7]
It didn't work either ... but I found that enabling the windows xp firewall solved the problem.