All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: using the same port with two sockets
       [not found] <Pine.A41.4.20.0309251006170.140698-100000@delfin.unideb.hu >
@ 2003-09-25 17:15 ` Jeff Woods
  2003-09-25 19:35   ` Fekete Gabor
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Woods @ 2003-09-25 17:15 UTC (permalink / raw)
  To: Fekete Gabor; +Cc: linux-c-programming

At 9/25/2003 10:16 AM +0200, Fekete Gabor wrote:
>with SOCK_STREAM if the server accept()s a connection it creates
>another sokcet that can be used to handle that connection.
>I want to do the same but with SOCK_DGRAM.
>So what I want is to recvfrom() a "connection" request and then
>create another socket to handle that "connection", that is, the
>server would go back to recvfrom() requests without worrying about
>packets arriving from the previously "accepted" client which would
>send those packets to the socket created especially for it.
>Is it possible?

Unlike SOCK_STREAM (aka TCP sockets) SOCK_DGRAM (aka UDP sockets) are 
connectionless.  Every new UDP packet arrives at the single listening 
socket which is bound to the UDP port addressed.  You can not have two 
sockets listening on the same UDP port (IIUC).

I recommend Richard Stevens' book "Unix Network Programming" (ISBN: 
013490012X ) for an excellent explanation.
http://www.amazon.com/exec/obidos/ASIN/013490012X

--
Jeff Woods <kazrak+kernel@cesmail.net> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: using the same port with two sockets
  2003-09-25 17:15 ` using the same port with two sockets Jeff Woods
@ 2003-09-25 19:35   ` Fekete Gabor
  2003-09-26  5:51     ` Patrik Jönsson
  0 siblings, 1 reply; 5+ messages in thread
From: Fekete Gabor @ 2003-09-25 19:35 UTC (permalink / raw)
  Cc: linux-c-programming



On Thu, 25 Sep 2003, Jeff Woods wrote:

> Unlike SOCK_STREAM (aka TCP sockets) SOCK_DGRAM (aka UDP sockets) are 
> connectionless.  Every new UDP packet arrives at the single listening 
> socket which is bound to the UDP port addressed.  You can not have two 
> sockets listening on the same UDP port (IIUC).
> 
it's ok. i know it.
i mean i would like to emulate the TCP connections with UDP.
ok the truth is, i need it because i want to make a client/server stuff
with udp.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: using the same port with two sockets
  2003-09-25 19:35   ` Fekete Gabor
@ 2003-09-26  5:51     ` Patrik Jönsson
  2003-09-26 15:28       ` Fekete Gabor
  0 siblings, 1 reply; 5+ messages in thread
From: Patrik Jönsson @ 2003-09-26  5:51 UTC (permalink / raw)
  To: 'Fekete Gabor'; +Cc: 'linux-c-programming'

One possible way should be to have a master process wich recieves the data,
looks the source IP:port pair up in a table and starts a new process if it
is not found, and otherwise uses some IPC (like pipes) mean to forward it to
the right process, the processes could then use another pipe to send replies
to the other host.



> -----Original Message-----
> From: linux-c-programming-owner@vger.kernel.org 
> [mailto:linux-c-programming-owner@vger.kernel.org] On Behalf 
> Of Fekete Gabor
> Sent: Thursday, September 25, 2003 9:36 PM
> To: unlisted-recipients:; no To-header on input
> Cc: linux-c-programming
> Subject: Re: using the same port with two sockets
> 
> 
> 
> 
> On Thu, 25 Sep 2003, Jeff Woods wrote:
> 
> > Unlike SOCK_STREAM (aka TCP sockets) SOCK_DGRAM (aka UDP 
> sockets) are
> > connectionless.  Every new UDP packet arrives at the single 
> listening 
> > socket which is bound to the UDP port addressed.  You can 
> not have two 
> > sockets listening on the same UDP port (IIUC).
> > 
> it's ok. i know it.
> i mean i would like to emulate the TCP connections with UDP.
> ok the truth is, i need it because i want to make a 
> client/server stuff with udp.
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe 
> linux-c-programming" in the body of a message to 
> majordomo@vger.kernel.org More majordomo info at  
http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: using the same port with two sockets
  2003-09-26  5:51     ` Patrik Jönsson
@ 2003-09-26 15:28       ` Fekete Gabor
  0 siblings, 0 replies; 5+ messages in thread
From: Fekete Gabor @ 2003-09-26 15:28 UTC (permalink / raw)
  Cc: 'linux-c-programming'



On Fri, 26 Sep 2003, [iso-8859-1] Patrik Jönsson wrote:

> One possible way should be to have a master process wich recieves the data,
> looks the source IP:port pair up in a table and starts a new process if it
> is not found, and otherwise uses some IPC (like pipes) mean to forward it to
> the right process, the processes could then use another pipe to send replies
> to the other host.
> 
yeah, and that's what i will do, though not with pipes.
thanks


-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* using the same port with two sockets
@ 2003-09-25  8:16 Fekete Gabor
  0 siblings, 0 replies; 5+ messages in thread
From: Fekete Gabor @ 2003-09-25  8:16 UTC (permalink / raw)
  To: linux-c-programming

hi

with SOCK_STREAM if the server accept()s a connection it creates
another sokcet that can be used to handle that connection.
I want to do the same but with SOCK_DGRAM.
So what I want is to recvfrom() a "connection" request and then
create another socket to handle that "connection", that is, the
server would go back to recvfrom() requests without worrying about
packets arriving from the previously "accepted" client which would
send those packets to the socket created especially for it.
Is it possible?

Does SOCK_STREAM create a new port too with the new socket? 

thanks



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-09-26 15:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.A41.4.20.0309251006170.140698-100000@delfin.unideb.hu >
2003-09-25 17:15 ` using the same port with two sockets Jeff Woods
2003-09-25 19:35   ` Fekete Gabor
2003-09-26  5:51     ` Patrik Jönsson
2003-09-26 15:28       ` Fekete Gabor
2003-09-25  8:16 Fekete Gabor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.