All pastes #768462 Raw Edit

Etwas

public text v1 · immutable
·published 2007-11-10 17:14 UTC
rendered paste body
;################################################################
Function WriteString(strdata$)
	For Done = 1 To Len(strdata$)
		WriteByte(ServerStream, Asc(Mid(strdata$, Done)))
	Next
	WriteByte ServerStream, 10
End Function
;################################################################
Function WriteInt(intdata)
	workdata$ = Str(intdata)
	For Done=1 To Len(workdata$)
		WriteByte ServerStream, Mid(workdata$, Done, 1)
	Next
	WriteByte ServerStream, 10
End Function
;################################################################
Function ReadString()
	returnstr$ = ""
	While ReadAvail(ServerStream) > 0 
		readedbyte = ReadByte(ServerStream)
		If readedbyte = 10 Then
			Exit
		Else
			returnstr$ = returnstr$+Chr(readedbyte)
		End If
	Wend
	Return returnstr$
End Function
;################################################################
Function ReadInt()
	returnstr$ = ""
	While ReadAvail(ServerStream) > 0 
		readedbyte = ReadByte(ServerStream)
		If readedbyte = 10 Then
			Exit
		Else
			returnstr$ = returnstr$+Chr(readedbyte)
		End If
	Wend
	Return Int(returnstr$)
End Function
;################################################################