In your procedure below, you have the
#PB_NetworkEvent_Data check, but you only do it once. If there isn't data in the network receive buffer, the
#PB_NetworkEvent_Data check will fail. Your code will continue after the
EndIf statement, where the procedure will end. You need loop statement to check
#PB_NetworkEvent_Data again, and a short delay to wait until your next attempt. You also need some sort of loop counter, so that if nothing is received with a reasonable amount of time, your loop can end with some sort of error message.
Code: Select all
Procedure receivedata(dccserver,waitfor$)
*Buffer = AllocateMemory(1000)
dsize = 100
If NetworkClientEvent(dccserver) = #PB_NetworkEvent_Data
FreeMemory(*Buffer)
*Buffer = AllocateMemory(1000)
dsize = ReceiveNetworkData(dccserver, *Buffer,1000)
;dsize = Len(PeekS(*Buffer))
;Debug dsize
;Debug PeekS(*Buffer)
EndIf
FreeMemory(*Buffer)
EndProcedure
There are many ways to accomplish what you need, with Infratec's being a good example. If you are serious about learning to code, I along with others will be glad to help you. The first thing I'd recommend is to download and read Kale's book! The second thing is to always use
EnableExplicit.