Limit on TCP Stream or String?

BlitzMax Forums/BlitzMax Programming/Limit on TCP Stream or String?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

It's being sent as ASCII, in one case terminated by ~r~n, and ~0 in the other direction.


Here is the code for the main connection in both directions. I got this off of the code archives and modified it slihtly. I'm certain there is no way the extra newlines are being added anywhere else in the program. As you can see it uses WriteString and ReadString
Type TCPSocketConnection
	Field MyID:String
	Field MyServer:TCPSocketServer
	Field MySocket:TSocket
	Field MyStream:TSocketStream
	Field Buffer:String = ""
	Field StopSeq:String
	
	Function Create:TCPSocketConnection(s:TCPSocketServer, NewSocket:TSocket)
		Local c:TCPSocketConnection = New TCPSocketConnection
		c.MyServer = s
		c.MySocket = NewSocket
		c.MyStream = CreateSocketStream(c.MySocket)
		c.StopSeq = c.MyServer.StopSeq
		c.MyID = DottedIP(c.MySocket.RemoteIP())
		Return c
	End Function

	Method Send(Text:String)
		MyStream.WriteString(Text)
	End Method

	Method Receive:String()
		Local nBytes:Int = MySocket.ReadAvail()
		Local s:String = StopSeq
		If nBytes Then
			Local in:String = ReadString(MyStream, nBytes)
			
			Buffer:+ in
			If Buffer.Length >= s.Length And Right$(Buffer,s.Length) = s Then
				
				Local t:String = Buffer.Replace(s,"") 'Strip out the Stop sequence
				Return t
				
			 End If
			
		End If
	End Method
	
End Type