Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Inflictive
16
Years of Service
User Offline
Joined: 16th Jun 2009
Location: Altis
Posted: 28th Feb 2012 03:04
Hi, I'm trying to make server software with matrix1 utility udp networking commands. Quick question- do I need to make a seperate socket for every user that joins the server, or does everyone use 1 socket? And if so, does that mean the host would need to port forward many ports for all the users, or what?

no u
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2012 17:04
You don't need more than one socket - just create a single UDP socket and bind it to your incoming port.



You can then use the SOCKET POLL READ function on this socket to see if any data has been received, and if so, use the RECV SOCKET MEMBLOCK to create a memblock containing the UDP packet data.

You can either use data from within the memblock to identify the client, or you can use SOCKET REMOTE IP and use their IP address.

Inflictive
16
Years of Service
User Offline
Joined: 16th Jun 2009
Location: Altis
Posted: 29th Feb 2012 04:54 Edited at: 29th Feb 2012 04:58
So wait, do you ever even need to "setup" a connection between two computers, or can you just send little packets of data to an ip and port?-
Actually, do you have an example of server and client software written with the matrix1 commands? I was going to use the regular dark basic multiplayer commands but I decided on these instead because they are more like "real" programming, and it seems like you can do more with them. I found the example for the built in dark basic multiplayer very useful, even if it was just one program and not client+server programs.
I didn't see an example for the matrix1 commands. Do you have something like a client and server software example so I can see exactly how the commands work?

Edit: I saw the tutorial in the matrix1 download page, I'll look over it and stuff.

no u
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Feb 2012 15:30
There's an important difference between a connectionless UDP data transfer and a TCP streaming connection - UDP packets are not guaranteed to be delivered, or delivered in any particular order.

If you don't mind the possibility of losing packets, or have a method of detecting missing packets and requesting retransmission, then UDP might be the way for you to go.

Otherwise, stick to the more dependable TCP connections. Or mix the two.

Quote: "I decided on these instead because they are more like "real" programming"

Once you understand these networking commands, then you will have a good understanding of Berkeley sockets and can reuse that knowledge on any system that supports them (which is pretty much any OS generally available in the world today).

Inflictive
16
Years of Service
User Offline
Joined: 16th Jun 2009
Location: Altis
Posted: 2nd Mar 2012 03:07
Just so you know, echo server#2, when used with echo client#1 or 2, crashes. As soon as you start the client, the server window fades to white and the "not responding" message pops up. I looked through the code and I can't figure out why. I have vista 64 bit btw.

no u
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Mar 2012 11:40
Ok, I'll check it out. Thanks for letting me know.

Login to post a reply

Server time is: 2025-08-08 15:11:38
Your offset time is: 2025-08-08 15:11:38