Hello, everyone.
I searched the forums but couldn't find an answer. Even a server in AppGameKit itself is difficult to obtain information on.
Is it possible to run PureBasic as a server? If so, where can I obtain the network data architecture for communicating between AppGameKit and PureBasic?
The thing is, I want to use PureBasic for threading, sqlite, and more GUI options.
Is there any source code available that shows a possible connection between those two products?
Any help is much appreciated!
Can I run PureBasic on AGK as a server?
Re: Can I run PureBasic on AGK as a server?
Hello!
My strong advice is to download the free demo purebasic, and test it. It will allow you to create test network code.
In theory, I think its possible to do it with UDP and manually created packets, but you can forget such features as sendnetworkstring.
(the two language handles strings differently, so you have to bypass those)
(I hope I understand well, you want a server written in PB, and an app written with AGK)
My strong advice is to download the free demo purebasic, and test it. It will allow you to create test network code.
In theory, I think its possible to do it with UDP and manually created packets, but you can forget such features as sendnetworkstring.
(the two language handles strings differently, so you have to bypass those)
(I hope I understand well, you want a server written in PB, and an app written with AGK)
Re: Can I run PureBasic on AGK as a server?
Minimal test. (not considered as networking)
This AGK code sends an UDP packet with a single byte, and it's value is 20.
That purebasic program receives it:
I own AGK classic, but I did not spent an hour with it in my whole life, so that is as far as I go.
Check this and upgrade this template with the demo PB to see if it fits for you.
This AGK code sends an UDP packet with a single byte, and it's value is 20.
Code: Select all
listenerid=CreateUDPListener("127.0.0.1",5060)
messageid = createnetworkmessage()
AddNetworkMessageByte(messageid,20)
SendUDPNetworkMessage(listenerid,messageid,"127.0.0.1",5080)
That purebasic program receives it:
Code: Select all
server=CreateNetworkServer(#PB_Any,5080,#PB_Network_UDP,"127.0.0.1")
OpenConsole("server")
PrintN(Str(server))
*dump=AllocateMemory(2048)
Repeat
If NetworkServerEvent(server)=#PB_NetworkEvent_Data
EC=EventClient()
bytes = ReceiveNetworkData(EC,*dump,2048)
PrintN(Str(bytes)+ "bytes has been received from "+ IPstring(GetClientIP(EC))+" .")
PrintN("The value of the byte is:"+Str(PeekA(*dump)))
Input()
End
EndIf
ForEver
Check this and upgrade this template with the demo PB to see if it fits for you.