Buggy file server program

BlitzPlus Forums/BlitzPlus Beginners Area/Buggy file server program

schilcote(Posted 2008) [#1]
I have a file server program which is written in B+ and initialises a TCP connection, and then loads a file with OpenFile. I am a veteran B2D programmer, and I understand Blitz's syntax, but I am new with the TCP stuff. I'll get packet sniffer details to you if you ask for them, and source too. Is is because I just can't use file access commands and TCP commands at the same time? I tried reversing the order of OpenFile and AcceptTCPConnection, but to no avail. It gives me the error "Invalid TCP stream identifier" or something to that effect.


Wings(Posted 2008) [#2]
Its simple

Writebytes in TCP only alows you to send about 8000 bytes at once. if you exceed this 8k buffer server will stall. and program halt for a while.

Write bytes in File IO seams to work widout ant problems for me.

If you get an "Invalid TCP stream" the stream cold have ben broken.

before use tcpip stream use reaavail to se if its -1 = broken stream.

if you use a broken streeam you will get error and a exit of program.


schilcote(Posted 2008) [#3]
You obviously think I am an idiot. It already does check to see if the stream is broken, right after it creates it. I still think that the problem is that you can't have an open file and TCP stream at the same time.


Wings(Posted 2009) [#4]
Yes you can have several streams open.
and mix em all :)

problem with tcp is a buffer owerflows at 8kb.

if it do owerflow program halts .. and stream becoms invalid.