SB as client, PB as server, possible?

Just starting out? Need help? Post your questions and find answers here.
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

SB as client, PB as server, possible?

Post by T4r4ntul4 »

Hi all,

Is it somehow possible to make SB as a client, and PB as a server?
If the answer is yes, what do i need to make it connect to each other?

Thoughts and or snippets are very appreciated!
plouf
Posts: 194
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Re: SB as client, PB as server, possible?

Post by plouf »

There is a demo http server in PB examples, isnt this enough ?

since every comand that SB can send back with httrequest and PB server will receive it !
Christos
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: SB as client, PB as server, possible?

Post by Peter »

T4r4ntul4 wrote:Is it somehow possible to make SB as a client, and PB as a server?
you can take a look at SpiderBite: https://github.com/spiderbytes/SpiderBite

(the description is in german, but you can use DeepL)

Greetings ... Peter
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Re: SB as client, PB as server, possible?

Post by T4r4ntul4 »

What i want to do, i want to use it as a game server, the SB client is the game, and PB will be the server. Is this, httrequest or spiderbytes fast enough for that? (Meaning: realtime movement between all clients, sending data to PB server and back to clients)
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: SB as client, PB as server, possible?

Post by Peter »

Than you can take a look at this topic using WebSocket-Communication:

http://forums.spiderbasic.com/viewtopic ... 362&p=4790

Greetings ... Peter
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Re: SB as client, PB as server, possible?

Post by T4r4ntul4 »

Thank you for the link Peter, it works perfectly!
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Re: SB as client, PB as server, possible?

Post by T4r4ntul4 »

I have a question related to this:

I wanted to use the SB client on my website to make a connection on my PC where the server is.
Only iam struggling to get it working properly.

What i have done so far:

in SB:
- changed the "ws://127.0.0.1:8090" to my own ip and port number: 27015

in PB:
- changed the: '*Server = WebSocket_Server::Create(27015, @WebSocket_Event())' ; this was port 8090

the rest:
- in my router i added a port forward to my internal ip and port with UDP and TCP port 27015
- on my computer i added in the firewall the same UDP and TCP ip and port 27015
- if i check on: https://www.yougetsignal.com/tools/open-ports/ on port 27015 the PB server says '#### client disconnected' so the portforward is good, otherwise i wont have that message anyway.
- if i test the same SB client with my outside ip and port, on my local PC, i can connect to my SB server which is on the same pc. that works.

Now comes the questions:
- did i miss something with firewall/ip/?
- can this work as i trying to do? (from website to pc?)

I use windows 10. and i use the code from Dirk Geppert, post: http://forums.spiderbasic.com/viewtopic ... 362&p=4790

Can someone shed some light on this? Your help is very much appreciated!
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Re: SB as client, PB as server, possible?

Post by T4r4ntul4 »

Turns out, my webhost doesnt support node.js / a second open port on the same website. :(
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Re: SB as client, PB as server, possible?

Post by T4r4ntul4 »

Sorry for the 'spam'. But a new message its on his place here for future reference.

Since all browser support websockets, websocket should work just out of the box. turns out my browser firefox blocks websocket (because i have https:// (ssl)), you can turn this on with:
i quote stackoverflow:
... https:// to ws:// is disallowed by default on firefox.

Going to firefox's about:config and toggling network.websocket.allowInsecureFromHTTPS will get rid of the SecurityError.
that solved it for me, so now you can just use Dirk his websocket code from your browser to PB server !!
Post Reply