[SDL] NET2 and Windows, successes? Strategies?

Frederic Barthelemy fbartholibsdllist at umich.edu
Wed Aug 3 12:44:55 PDT 2005


[OT]-This is my first message to the mailing list, so hopefully I won't make 
too much of a fool of myself.

[Background]
I'm new to network programming. I ran across libsdl about a year ago and 
realized how many different things it could do and I was almost overwhelmed. 
Some friends of mine and I used it as an interface for our small flight 
simulator game. I put it out of my mind until I was working on a new project 
where I wanted to write a music/file client of sorts. Looking around for 
cross-platform network code examples, that I could teach myself from, I ran 
again across SDL in the form of SDL_Net . After fiddling around with that 
for awhile I started to hack together an idea of the structure I wanted my 
network code. It was very ugly, drawing from a simple chatroom program and 
making it do things it really wasn't meant for. Then I ran across the NET2 
library by Robert Pendleton (http://www.gameprogrammer.com/game.html - can 
be found in the 3rd party libraries section of libsdl.org), and I realized I 
had found exactly what I wanted to use for my network managment. I grabbed 
the files and went to work looking at the examples to figure out how to use 
it.

[Problem]
I attempted to compile the client and server examples and after dealing with 
configuration issues, I had two binaries (there was an issue where windows 
would need to have the INIT_EVENTTHREAD flag left off).  I ran the server, 
and it seems to work correctly, but when I run the client it fails to 
connect to the server. When debugging, I figured out that when resolving the 
host (to localhost or various IP's pointing at my machine) the SDL_Net 
function would return a different port from the one "I" asked for (wanted: 
6666 received 2586) no matter what I do I can't seem to get the client to 
work properly.

[Setup]
I'm running this on a P4 4ghz w/2gb RAM running WinXPSP2 private home 
network behind two NATting routers. This machine has no firewalls enabled. 
I'm compiling with Microsoft Visual Studio 2003 .NET, my code is C/C++ for 
this project.  I have SDL and SDL_Net to the best of my knowledge properly 
installed (I've been using them in separate projects) but I can't seem to 
get NET2 setup so that this problem doesn't occur.

I've talked to Robert Pendleton, and though he has had it work properly, he 
hasn't for awhile had a machine running Windows, and he suggested I mail 
this list. If anybody has had problems similar to mine, or better still 
would have any ideas how I can get NET2 to work properly, I would greatly 
appreciate the help.

Thanks,
-Frederic B.





More information about the SDL mailing list