Help with SDL_Net

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
Slowburn
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 1
Joined: Tue Oct 27, 2009 10:12 pm

Help with SDL_Net

Post 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.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Help with SDL_Net

Post 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?
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Help with SDL_Net

Post 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.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Help with SDL_Net

Post 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.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply