I was wondering if someone can help me
i am trying to send some data to a Windows application I created (via TCP/IP) but when ever I run the Freebasic App it crashes
Below is my code
Code: Select all
#include once "snc.bi"
#include once "snc_utility.bi"
Dim request As String = "Sale|1599"
Dim status As String
Dim pbuffer As ZString Ptr
Dim BufferSize As Integer
var Client = NetworkClient("127.0.0.1",15975)
var Server = NetworkServer(15976)
var ServerConnection = Client.GetConnection()
var ClientConnection = Server.GetConnection()
'send any data:
if ClientConnection->CanPut() then
'status = ClientConnection->PutData(Trim(request),len(request))
'receive any data:
if ServerConnection->CanGet() then
'status= 0 Server/Client Disconnected
'status=-1 PutData/GetData Error
'status> 0 nBytes sended or received
'If something goes wrong you can check the ErrorCode.
'ErrorCode = Client.GetLastError()
'ErrorCode = Server.GetLastError()
'ErrorCode = Connection->GetLastError()
'if ErrorCode then print GetNetworkErrorText(ErrorCode)
What I am trying to do is send a command the the Server app (windows program) the command "Sale|1599" should be received by the App on port 15975 and then the Module would then send back on 15976 loads of status messages once it has sent back the final command the module then closes the 15976 port and then waits again for another request
What I would the the Freebasic app to do is send the "Sale|1599" to the add on module and then print to the debug window (for now) everything the add on program is sending back on 15976.
I will at some point need to have this working over a LAN Network (so I can not keep using 127.0.0.1)
if some one can tell me where I have gone wrong or show me what I miss understood I would be most greatful