Neep help with a file sending program

Blitz3D Forums/Blitz3D Programming/Neep help with a file sending program

XtremeCoder(Posted 2007) [#1]
whats wrong here:

server:

mainsvr=CreateTCPServer(8080) ;create the server
If mainsvr<>0 Then
Print "Server started successfully."
Else
Print "Server failed to start."
End
End If
fileout = WriteFile("file.txt")

While Not KeyHit(1)
strStream=AcceptTCPStream(mainsvr)

If strStream Then

WriteByte( fileout, ReadByte(strStream) )
End If
Wend
End



Client:

mainsvr=OpenTCPStream("127.0.0.1",8080)
If mainsvr<>0 Then
Print "Client Connected successfully."
Else
Print "Server failed to connect."
WaitKey
End
End If
name$ = Input("Name: ")
FlushKeys
; write stream to server
file=OpenFile("file.txt")
While Not Eof(file)
WriteByte mainsvr,ReadByte(file)
Wend


amitjf(Posted 2007) [#2]
what this line is for?(
name$ = Input("Name: ")
)
and for the
 mainsvr=OpenTCPStream("127.0.0.1",8080) 

if your are testing the server and the client on the same computer I would have using
For i = 1 To CountHostIPs("")
	hip 	= HostIP(i)
Next
mainsvr=OpenTCPStream(DottedIP(hip),8080)



Xzider(Posted 2007) [#3]
AcceptTCPStream(Stream%) purpose only checks to see if theres a connection, not if someone is sending data. Try looking at readavail command, and maybe user types. I might post some code later...I made a updating program that checks from a website and downloads files once, got it to work with a website I was using, still working on compatibility with my webserver.


XtremeCoder(Posted 2007) [#4]
nvm i got it to work before, thanks though...