hi everyone.
I work on a few Network-Commands for my game. The UDP-Part runs fine, but I have some problems using TCP in the same program.
Here is the (simplified) code from the client:
Reader=ReadFile("pic.png")
tcpstream=OpenTCPStream(BMP_ServerIP,7999) ;,7999)
If tcpstream Then
Repeat
WriteInt tcpstream,ReadInt(Reader)
Until Eof(Reader)
CloseTCPStream tcpstream
CloseFile Reader
Endif
And here's the (simplified) code from the server:
Writer=WriteFile("picx.png")
Servertcp=CreateTCPServer(7999)
timeout=1500
time=Millisecs()
Repeat
tcpstream=AcceptTCPStream(Servertcp)
If tcpstream<>0 Then
time=Millisecs()
Repeat
Integer=ReadInt(tcpstream)
WriteInt(Writer,Integer)
Until Integer=0
Exit
EndIf
Until MilliSecs()-time>timeout
And here some things I know about my problem:
UDP is using other ports.
The "servertcp" exists, the file "pic.png" too.
I have tested this program in my LAN. In this LAN I can play games and use other Blitz-programs.
Can somebody help me out, please?
I work on a few Network-Commands for my game. The UDP-Part runs fine, but I have some problems using TCP in the same program.
Here is the (simplified) code from the client:
Reader=ReadFile("pic.png")
tcpstream=OpenTCPStream(BMP_ServerIP,7999) ;,7999)
If tcpstream Then
Repeat
WriteInt tcpstream,ReadInt(Reader)
Until Eof(Reader)
CloseTCPStream tcpstream
CloseFile Reader
Endif
And here's the (simplified) code from the server:
Writer=WriteFile("picx.png")
Servertcp=CreateTCPServer(7999)
timeout=1500
time=Millisecs()
Repeat
tcpstream=AcceptTCPStream(Servertcp)
If tcpstream<>0 Then
time=Millisecs()
Repeat
Integer=ReadInt(tcpstream)
WriteInt(Writer,Integer)
Until Integer=0
Exit
EndIf
Until MilliSecs()-time>timeout
And here some things I know about my problem:
UDP is using other ports.
The "servertcp" exists, the file "pic.png" too.
I have tested this program in my LAN. In this LAN I can play games and use other Blitz-programs.
Can somebody help me out, please?