[ You are not allowed to view this attachment ]
SCREEN 12
DIM i AS STRING * 32 ' set length of string to get from file/ send on net
bl = 32 ' for program calculation
server& = _OPENHOST("TCP/IP:59999")
PRINT "Waiting for connection..."
DO
connection& = _OPENCONNECTION(server&)
LOOP UNTIL connection& <> 0
PRINT "recieved connection"
GAME:
PRINT "sending bytes"
_DELAY .5
OPEN "beavis.avi" FOR BINARY AS #1
' get file length, make it be 32 bytes
p$ = STR$(LOF(1))
PRINT p$
x = LEN(p$)
q = 32 - x
FOR z = 1 TO q
o$ = o$ + " "
NEXT
p$ = o$ + p$
PRINT LEN(p$)
PRINT p$
FOR z = 1 TO 32
a$ = MID$(p$, z, 1)
PUT #connection&, , a$
NEXT
PRINT "Waiting for send instruction..." ' wait for "!" from client
wfi:
GET #connection&, , a$
IF a$ <> "!" THEN GOTO wfi
PRINT "Sending data ..."
_DELAY 0.2
' send file data
lf& = LOF(1)
PRINT lf&
PRINT "Sending bulk data..."; bl; "bbyte legnth"
OPEN "beavis2.avi" FOR BINARY AS #3 ' for testing, write to local disk the data being sent over net
FOR x& = 1 TO lf& STEP bl ' repeat until end of file, increment of bytes sent each time
GET #1, x&, i
PUT #connection&, , i
PUT #3, , i ' to local disk, for testing
' _DELAY (.0001) ' Playing around with this number changes the data recieved on other end
NEXT
dtft:
CLOSE
CLEAR
END