Handling a basic server/client connection

BlitzMax Forums/BlitzMax Programming/Handling a basic server/client connection

Pineapple(Posted 2010) [#1]
I need to write a simple piece of database software where the client can relay small bits of information back and forth. The thing is, all my past ventures into getting TCP networking to do what I want in Bmax have been unsuccessful.

Can I just have some example code of a client and a server sending information back and forth on a local machine? Thanks.


beanage(Posted 2010) [#2]
Good question, I never managed to get my head around that too!


plash(Posted 2010) [#3]
Sockets are really simple. I like to go for the message-based approach.
EDIT: See here.


slenkar(Posted 2010) [#4]
If the server is behind a firewall or router you need a website

the client sends a message to the php script on the website when it wants to connect
Then the server queries the website (through php) to see if any clients want to connect,


the website stores IP addresses in a mysql table for clients and servers

then the clients and servers send messages to each other at the same time using the IP addresses from the mysql table.

This allows clients to get through the firewall or router.(so people dont have to forward ports)

This is the method that Skype uses.


Pineapple(Posted 2010) [#5]
I got it up and running basing it off a code example I found searching.



@slenkar - that hasn't a thing to do with what I'm worried about :P


Czar Flavius(Posted 2010) [#6]
Plash do you release that code to the public domain?


plash(Posted 2010) [#7]
Plash do you release that code to the public domain?
I could say that goes without saying (being an open area), but this should suffice as an answer.