UDP Through Closed ports!?

The port number is stored in the IPaddress struct:

http://www.libsdl.org/cgi/docwiki.cgi/IPaddress

norco at ten-arc.net wrote:

I think I just realised what I’m doign wrong. For some reason I thought if
I sent a packet to the nat port of the peer socket listening on 12345 the
nat would send it to that port… What im going do now is when TCP server A
gets a packet udp from B it sends B with TCP B’s source port to host on.
tell me if I’m wrong

Oups, I said a mistake :slight_smile: I should have checked the detail of the IPaddress
struct.

Well, forget what I said and here is how it should work.

Server opens a socket. Client sends an UDP packet. Server reads the info
with SDLNet_UDP_Recv. Server sends response back to packet->address.

omg it won’t work. it ALWAYS says port = 49245 =[[[ but gets right address

	err=SDLNet_UDP_Recv(sockudp, in);
	if(err == 1) {
		sprintf(udpport, "%d", in->address.port);
		MessageBox(NULL, udpport, NULL, NULL);
            *ding* "49245" ; // NOT NAT PORT OR ANY PORT I KNOW OF

I’ve gotten nothing done in two days now. I’m supposed to have beta by
this weekend… im screwed thanks to SDL_net, unless someone can show me
the RIGHT way… oh freaken hell I have no problem with socket.h on windows
or linux maybe I’ll drop sdlnet for sockets then… pleaseeee arg, back to
google for the rest of the night… in the time its taken I could have put
in sockets but I’m stubborn and want to use all of sdl…> @norco_at_ten-arc.net wrote:

I think I just realised what I’m doign wrong. For some reason I thought
if
I sent a packet to the nat port of the peer socket listening on 12345
the
nat would send it to that port… What im going do now is when TCP server
A
gets a packet udp from B it sends B with TCP B’s source port to host on.
tell me if I’m wrong

Oups, I said a mistake :slight_smile: I should have checked the detail of the
IPaddress
struct.

Well, forget what I said and here is how it should work.

Server opens a socket. Client sends an UDP packet. Server reads the info
with SDLNet_UDP_Recv. Server sends response back to packet->address.


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

here I go again. I have more info of the problem:
udp source port from sdl_net = 25092(source is always sending to 24000)
but real source port is 1122(nat). example 2: if real port is 1124(nat)
then sdl_net shows 25604… could anyone have a clue as to what the casting
problem or whatever is> omg it won’t work. it ALWAYS says port = 49245 =[[[ but gets right address

  err=SDLNet_UDP_Recv(sockudp, in);
  if(err == 1) {
  	sprintf(udpport, "%d", in->address.port);
  	MessageBox(NULL, udpport, NULL, NULL);
            *ding* "49245" ; // NOT NAT PORT OR ANY PORT I KNOW OF

I’ve gotten nothing done in two days now. I’m supposed to have beta by
this weekend… im screwed thanks to SDL_net, unless someone can show me
the RIGHT way… oh freaken hell I have no problem with socket.h on windows
or linux maybe I’ll drop sdlnet for sockets then… pleaseeee arg, back to
google for the rest of the night… in the time its taken I could have put
in sockets but I’m stubborn and want to use all of sdl…

@norco_at_ten-arc.net wrote:

I think I just realised what I’m doign wrong. For some reason I thought
if
I sent a packet to the nat port of the peer socket listening on 12345
the
nat would send it to that port… What im going do now is when TCP
server
A
gets a packet udp from B it sends B with TCP B’s source port to host
on.
tell me if I’m wrong

Oups, I said a mistake :slight_smile: I should have checked the detail of the
IPaddress
struct.

Well, forget what I said and here is how it should work.

Server opens a socket. Client sends an UDP packet. Server reads the info
with SDLNet_UDP_Recv. Server sends response back to packet->address.


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

Problem solved. the l33t in #c++ on efnet told me it was an endian problem
and then i figured out the use for SDLNet_Read16> here I go again. I have more info of the problem:

udp source port from sdl_net = 25092(source is always sending to 24000)
but real source port is 1122(nat). example 2: if real port is 1124(nat)
then sdl_net shows 25604… could anyone have a clue as to what the casting
problem or whatever is

omg it won’t work. it ALWAYS says port = 49245 =[[[ but gets right
address

  err=SDLNet_UDP_Recv(sockudp, in);
  if(err == 1) {
  	sprintf(udpport, "%d", in->address.port);
  	MessageBox(NULL, udpport, NULL, NULL);
            *ding* "49245" ; // NOT NAT PORT OR ANY PORT I KNOW OF

I’ve gotten nothing done in two days now. I’m supposed to have beta by
this weekend… im screwed thanks to SDL_net, unless someone can show me
the RIGHT way… oh freaken hell I have no problem with socket.h on
windows
or linux maybe I’ll drop sdlnet for sockets then… pleaseeee arg, back
to
google for the rest of the night… in the time its taken I could have
put
in sockets but I’m stubborn and want to use all of sdl…

@norco_at_ten-arc.net wrote:

I think I just realised what I’m doign wrong. For some reason I
thought
if
I sent a packet to the nat port of the peer socket listening on 12345
the
nat would send it to that port… What im going do now is when TCP
server
A
gets a packet udp from B it sends B with TCP B’s source port to host
on.
tell me if I’m wrong

Oups, I said a mistake :slight_smile: I should have checked the detail of the
IPaddress
struct.

Well, forget what I said and here is how it should work.

Server opens a socket. Client sends an UDP packet. Server reads the
info
with SDLNet_UDP_Recv. Server sends response back to packet->address.


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


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

If someone can verify this, it would save my an on going nighmare. I’m
looking at the udpclientftp example and see no udp server. Now that’s
exactly what I’m having trouble with. I don’t know how to use channels per
client address. when I do:

SDLNet_UDP_Bind(sockudp, newclientindex, &newclientip);

it screws everything up and nothing gets sent… any examples of a udp
server would be great> What about the SDL_Net examples? There’s a UDP ftp client/server in there,

and clearly each has to do 2-way communication to ensure a file gets sent
correctly.

Gregory

On Wed, 12 Apr 2006, @norco_at_ten-arc.net wrote:

Yes, Spencer has made that perfectly clear. I have even made a winsock
application to test out my routers nat. I had no problems gettings the
udp
port from the sending client to send back to. but with SDL I am unable
to.
I can do everything else for this game I’m writing, most of the game is
done. but I can’t figure out how to get source ports from the packet.
and
even if I obtain them with eitherreal and edit the code with the nat
port
during debug-time I simply cant get any packets through it SDL wont let
me… I REALLY need examples badly and I spent hours googling and cant
find
any…


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

Well now I fixed the problem with the channels not working… it seems that
when a client disconnects from the server the server should unbind its
address… lol> If someone can verify this, it would save my an on going nighmare. I’m

looking at the udpclientftp example and see no udp server. Now that’s
exactly what I’m having trouble with. I don’t know how to use channels per
client address. when I do:

SDLNet_UDP_Bind(sockudp, newclientindex, &newclientip);

it screws everything up and nothing gets sent… any examples of a udp
server would be great

What about the SDL_Net examples? There’s a UDP ftp client/server in
there,
and clearly each has to do 2-way communication to ensure a file gets
sent
correctly.

Gregory

On Wed, 12 Apr 2006, @norco_at_ten-arc.net wrote:

Yes, Spencer has made that perfectly clear. I have even made a winsock
application to test out my routers nat. I had no problems gettings the
udp
port from the sending client to send back to. but with SDL I am unable
to.
I can do everything else for this game I’m writing, most of the game is
done. but I can’t figure out how to get source ports from the packet.
and
even if I obtain them with eitherreal and edit the code with the nat
port
during debug-time I simply cant get any packets through it SDL wont let
me… I REALLY need examples badly and I spent hours googling and cant
find
any…


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

http://jcatki.no-ip.org/SDL_net/demos/udptftpserver.c

GregoryOn Thu, 2006-04-13 at 05:17 -0500, norco at ten-arc.net wrote:

If someone can verify this, it would save my an on going nighmare. I’m
looking at the udpclientftp example and see no udp server. Now that’s
exactly what I’m having trouble with. I don’t know how to use channels per
client address. when I do:

SDLNet_UDP_Bind(sockudp, newclientindex, &newclientip);

it screws everything up and nothing gets sent… any examples of a udp
server would be great