Page 1 of 1

Help with SDL_Net

Posted: Tue Oct 27, 2009 10:31 pm
by Slowburn
Can someone explain using SDL_Net to transfer an int value. I've googled and googled and found only one tutorial on the matter.
http://gpwiki.org/index.php/SDL:Tutorial:Using_SDL_net
Now i understand all of the functions, but i don't understand why you use the function. Oh it returns the port of the computer, why do i need that. Can someone explain how I would go about sending an int value from one computer to another over a peer to peer network ?

P.S.
Like you use this function to open the port. You need to do that first. It makes it possible to send your data through, then you make this loop so...
I just don't understand the rest. Hope this isn't too newbish of a question.

Re: Help with SDL_Net

Posted: Fri Oct 30, 2009 9:06 am
by MarauderIIC
Can you be a little more specific? What part don't you understand?

For instance, you write, "it returns the port". What returns the port?

Re: Help with SDL_Net

Posted: Fri Oct 30, 2009 12:01 pm
by Falco Girgis
I think your problem lies more with lack of knowledge of general networking than the SDL_Net API itself. Connecting to a port is part of establishing a TCP/UDP connection for the application layer of the network stack. You should read up on it, then what SDL_Net does might make more sense.

Re: Help with SDL_Net

Posted: Fri Oct 30, 2009 8:04 pm
by MarauderIIC
Beej's Guide to Network Programming (google) is the one I always recommend. You won't necessarily be able to follow the tutorials when using SDL_Net, but you'll gain an understanding of what's going on.