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

SB as client, PB as server, possible?

by T4r4ntul4 Tue Feb 20, 2018 12:28 am

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: 34
Joined: Tue Feb 25, 2014 6:01 pm

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

by plouf Tue Feb 20, 2018 12:43 am

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 !
User avatar
Peter
 
Posts: 486
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

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

by Peter Tue Feb 20, 2018 8:16 am

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: 117
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands

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

by T4r4ntul4 Tue Feb 20, 2018 11:29 am

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: 486
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

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

by Peter Tue Feb 20, 2018 11:54 am

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

http://forums.spiderbasic.com/viewtopic.php?f=12&t=1362&p=4790

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

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

by T4r4ntul4 Tue Feb 20, 2018 1:00 pm

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

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

by T4r4ntul4 Fri Feb 23, 2018 11:58 pm

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: viewtopic.php?f=12&t=1362&p=4790

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

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

by T4r4ntul4 Sat Feb 24, 2018 10:59 am

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

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

by T4r4ntul4 Sun Feb 25, 2018 7:34 am

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 !!
Return to Coding Questions

Who is online

Users browsing this forum: No registered users and 1 guest