BNetEx TCP streams limited?

BlitzMax Forums/BlitzMax Programming/BNetEx TCP streams limited?

Hi,

are there any limits how much can be sended via TCP-stream?
I can send files to a size somewhere around 120 kb. If my file
is bigger I receive a file filled with 0-bytes.

' used for sending
Method Filecopy(name:String, stream:TTCPStream)
	'sends a complete file
	' DOES NOT work with files >~100 kb
	
	Local size:Long = FileSize(name)
	' send file size 
	DebugLog ("Filesize:" + size)
	WriteLong(stream, size)
	stream.SendMsg()
	Local fstream:TStream = OpenFile(name)
	While Not Eof(fstream)
		b:Byte = ReadByte(fstream)
		WriteByte (stream, b)
	Wend
	stream.SendMsg()
	CloseFile(fstream)
End Method


' used for receiving

Method ReceiveFileFromHost(filename:String, stream:TTCPStream)
	' DOES NOT work with files >~120 kb
	Local stringlen:Long
	While Not stringlen
		stringlen = stream.RecvAvail()
	Wend
	stream.RecvMsg() ' receive the long with filesize
	Local fsize:Long = stream.ReadLong()
	
	Delay 1000
	stream.RecvMsg()
	DeleteFile(filename)
	CreateFile(filename)
	Local out:TStream = OpenFile(filename)
	Local count:Long
	For count = 1 To fsize
'		If stream.RecvAvail() ' another part of file is coming in		
			'stream.RecvMsg()
			Local b:Byte = ReadByte(stream)
			WriteByte(out, b)		
'		End If
	Next
	DebugLog ("File complete")
	out.Close()
	'stream.Close()


You probably want to do that in chunks.. not the whole load right away.

Yes, I believe this has something to do with your MTU size. Send it in several smaller packets and you really won't have a limit in what size of a file you can send.

It is "by design", tcp or udp packets are limited in size, the tricky part is that this size is relative to the OS/Network hardware combo.

Ok. Thanks.