TCP/UDP question

BlitzMax Forums/BlitzMax Programming/TCP/UDP question

kronholm(Posted 2007) [#1]
I've made my own client/server before with TCP, and now I'm trying to make one with UDP but I'm having some trouble.

How can I identify where the UDP connection comes from? The function SocketRemoteIP(udpsocket) always seem to be zero, even if there's a connection active on the socket.

In TCP I would use SocketAccept(mytcpsocket) to check if a connection had been made, but this does not, according to the docs, work with UDP.

I just wanna know basically, if it's possible in some way to distinguish connections to an UDP socket. If I want to make a multiplayer game, it would be nice to know who or what is sending to the socket.. Am I making sense?


*(Posted 2007) [#2]
I would like to know this as well, the networking system of BlitzMax doesnt seem to be well documented. Is there a demo that shows a server/client system using sockets etc.

Blitz3d and Blitz+ had simple connection commands that were easy to follow and use the new system seems overly complicated.


Vertex(Posted 2007) [#3]
If you interested in it, BNetEx:
http://www.blitzbasic.com/Community/posts.php?topic=50723
(UDP examples includet)

It's very easy to detect, where is the sender:
MyUDPStream.RecvMsg()
Print TNetwork.StringIP(MyUDPStream.GetMsgIP())
Print MyUDPStream.GetMsgPort()

I use BNetEx successfully in a gameserver and in a spider on a Unix server. The spider runs 24h of every day and spiders tausends of website content(registered websites).

cu olli


kronholm(Posted 2007) [#4]
Thanks vertex, I'll dig through the code of bnetex to see how they come up with the source ip..


Chroma(Posted 2007) [#5]
Make the initial connection with TCP then use the info from that to switch to UDP.


*(Posted 2007) [#6]
interesting idea :)


kronholm(Posted 2007) [#7]
Yeah I hadn't thought of that, I think I'll give it a try.. Doesn't seem like people know how to get the connecting client info any other way :(