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
'Client
var Client = NetworkClient("127.0.0.1",15975)
'Server:
var Server = NetworkServer(15976)
'Connections:
var ServerConnection = Client.GetConnection()
var ClientConnection = Server.GetConnection()
'send any data:
if ClientConnection->CanPut() then
'status = ClientConnection->PutData(Trim(request),len(request))
ClientConnection->PutData(strptr(request),len(request))
end if
'receive any data:
if ServerConnection->CanGet() then
ServerConnection->GetData(pbuffer)
end if
'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 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