tcp/ip exe transfer

Blitz3D Forums/Blitz3D Beginners Area/tcp/ip exe transfer

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

I tryed it, but it copy only 1 byte...

This is the code:

;Listener(receive file)

svrcom=CreateTCPServer(9015)

If svrcom<>0 Then
Print "Server started successfully."
Else
Print "Server failed to start."
End
End If

While Not KeyHit(1)
strstream=AcceptTCPStream(svrcom)
If strstream Then
Print ReadString$(strstream)
WaitKey()
End
Else
Print "Attempting messages..."
Delay 1000
End If
Wend

End


;Server(send file)
strmcom=OpenTCPStream("127.0.0.1",9015)

file = ReadFile("agent.exe")
fileout=ReadFile("agent2.exe")

If strmcom<>0 Then
Print "Client Connected successfully."
Else
Print "Server failed to connect."
WaitKey
End
End If


While Not Eof(file)
linea = ReadByte( file )
WriteByte(strmcom,linea)
Wend
CloseFile( file )
CloseFile(fileout)

Print "Completed sending message..."