Net2

Hi,
I created some socket classes arround net2 ( modified )

One of the design goals of NET2 was to make it easy to wrap a class
around the whole library. Also, the socket type is opaque so that people
who want to use C or bind NET2 to other languages, could use it as if it
were a class.

& SDL_Net.
Now i was wondering : is it possible to set the NIC to be used to run a
server sock on.
because starting a server and then finding out it’s listing on the correct
port but on the wrong network card isn’t very helpful :slight_smile:

Take a look at the function:

int NET2_TCPAcceptOnIP(IPaddress *ip);

This lets you accept connections on a specific IP address, port pair as
specified in the IPaddress structure. The function is documented at:
http://gameprogrammer.com/net2/net2-3.html If it doesn’t work, let me
know.

	Bob PendletonOn Sat, 2003-04-12 at 09:49, Dinand Vanvelzen wrote:

GreeTz.
DV


±----------------------------------+

  • Bob Pendleton: independent writer +
  • and programmer. +
  • email: Bob at Pendleton.com +
    ±----------------------------------+

specified in the IPaddress structure. The function is documented at:
http://gameprogrammer.com/net2/net2-3.html If it doesn’t work, let me
know.

Now it’s works!
:slight_smile:

Bye!

I implemented it using that function before but NET2 tried to connect to a
remote host instead of listning on a local port, actually i should say
SDL_Net tried to connect to a remote host.
The problem is located here :*********************

TCPsocket SDLNet_TCP_Open(IPaddress *ip)
{
EndpointRef dummy = NULL;

TCPsocket sock = AsyncTCPNewSocket();
if( ! sock)
return NULL;

// Determin whether bind locally, or connect to remote
if ( (ip->host != INADDR_NONE) && (ip->host != INADDR_ANY) )
{
// ######## Connect to remote


this is in the file : "SDLnetTCP.c"
and causes a connection attempt to a remote host instead of listning on a
local NIC with the given port.
This led me to the conclusion that
NET2_TCPAcceptOnIP() is the same as
NET2_TCPAcceptOn() with a different parameter where the address in
IPaddress must me NULL.

Happy Coding
DV.

----- Original Message -----
From: bob@pendleton.com (Bob Pendleton)
To: “Dinand Vanvelzen” <@Dinand_Vanvelzen>
Cc: “SDL Mailing List”
Sent: Sunday, April 13, 2003 1:47 AM
Subject: [SDL] Re: Net2

On Sat, 2003-04-12 at 09:49, Dinand Vanvelzen wrote:

Hi,
I created some socket classes arround net2 ( modified )

One of the design goals of NET2 was to make it easy to wrap a class
around the whole library. Also, the socket type is opaque so that people
who want to use C or bind NET2 to other languages, could use it as if it
were a class.

& SDL_Net.
Now i was wondering : is it possible to set the NIC to be used to run a
server sock on.
because starting a server and then finding out it’s listing on the
correct

port but on the wrong network card isn’t very helpful :slight_smile:

Take a look at the function:

int NET2_TCPAcceptOnIP(IPaddress *ip);

This lets you accept connections on a specific IP address, port pair as
specified in the IPaddress structure. The function is documented at:
http://gameprogrammer.com/net2/net2-3.html If it doesn’t work, let me
know.

Bob Pendleton

GreeTz.
DV


±----------------------------------+

  • Bob Pendleton: independent writer +
  • and programmer. +
  • email: Bob at Pendleton.com +
    ±----------------------------------+

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I implemented it using that function before but NET2 tried to connect to a
remote host instead of listning on a local port, actually i should say
SDL_Net tried to connect to a remote host.
The problem is located here :


TCPsocket SDLNet_TCP_Open(IPaddress *ip)
{
EndpointRef dummy = NULL;

TCPsocket sock = AsyncTCPNewSocket();
if( ! sock)
return NULL;

// Determin whether bind locally, or connect to remote
if ( (ip->host != INADDR_NONE) && (ip->host != INADDR_ANY) )
{
// ######## Connect to remote

Looks like you found a bug in SDLNet.

	Bob PendletonOn Mon, 2003-04-14 at 14:11, Dinand Vanvelzen wrote:

this is in the file : "SDLnetTCP.c"
and causes a connection attempt to a remote host instead of listning on a
local NIC with the given port.
This led me to the conclusion that
NET2_TCPAcceptOnIP() is the same as
NET2_TCPAcceptOn() with a different parameter where the address in
IPaddress must me NULL.

Happy Coding
DV.

---- Original Message -----
From: “Bob Pendleton” <@Bob_Pendleton>
To: “Dinand Vanvelzen”
Cc: “SDL Mailing List”
Sent: Sunday, April 13, 2003 1:47 AM
Subject: [SDL] Re: Net2

On Sat, 2003-04-12 at 09:49, Dinand Vanvelzen wrote:

Hi,
I created some socket classes arround net2 ( modified )

One of the design goals of NET2 was to make it easy to wrap a class
around the whole library. Also, the socket type is opaque so that people
who want to use C or bind NET2 to other languages, could use it as if it
were a class.

& SDL_Net.
Now i was wondering : is it possible to set the NIC to be used to run a
server sock on.
because starting a server and then finding out it’s listing on the
correct

port but on the wrong network card isn’t very helpful :slight_smile:

Take a look at the function:

int NET2_TCPAcceptOnIP(IPaddress *ip);

This lets you accept connections on a specific IP address, port pair as
specified in the IPaddress structure. The function is documented at:
http://gameprogrammer.com/net2/net2-3.html If it doesn’t work, let me
know.

Bob Pendleton

GreeTz.
DV


±----------------------------------+

  • Bob Pendleton: independent writer +
  • and programmer. +
  • email: Bob at Pendleton.com +
    ±----------------------------------+

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±----------------------------------+

  • Bob Pendleton: independent writer +
  • and programmer. +
  • email: Bob at Pendleton.com +
    ±----------------------------------+

Hello,

I would like to get a single event source for an application relying
on SDL. It means I need to use user defined events. I want to
integrate networks and gui into the SDL Event loop. I already looked
at the Net2 and fast events set of features provided by Bob Pendelton.
I would like a little guideline to integrate user define events in SDL
event loop, in the general case. How does this loop work is their any
way to plug new “event listener” so that SDL inspect other devices.

Is there some customatization point in this loop ?

The second question concerns the Net2 function set, in order to use it
in a project not release under GPL or LGPL, the best way to do thing
is to pack the files in a dynamic library, am I right ? (License is
going to be MIT or CeCILL both open source)

Regards
Olivier

Is there some plans to include Net2 and|/or FastEvents in SDL 1.3?

If there is no way to integrate them in 1.2 a way to integrate
"custom" event souce would be really helpfull in 1.3On 5/29/06, ??? ??? <roman.kyrylych at gmail.com> wrote:

Is there some plans to include Net2 and|/or FastEvents in SDL 1.3?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl