[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

I/O multiplexing among socket descriptors



Hello Everybody,

I need some help regarding socket programming.I need to do multiplex between
multiple sockets. For the same purpose I tried 2 approaches.

1. using select
2. using S_RCVTIMEO socket option.

I wrote 2 simple programs - one that uses socket option and the other that
uses select call. The program can accept UDP dgrams on 2 UDP ports.i created
3 simple programs.
selrecv.c - uses select to multiplex between the 2 udp ports

sockrecv.c - uses socket options to multiplex between the 2 udp ports

sender.c - sends udp dgrams. change the port no in the program to 8000
,create an executable and again change the program to 6000 and create
another executable.and use them 2 send dgrams to the 2 ports.

But both the approaches failed...
1. while using select unless dgram is first got from sockfd1 ( the first
recvfrom call) it does not go to the next recvfrom call..ie it blocks at
recvfrom then at select

2. while using socket option. i change the socket options using setsockopt .
but when i verify it with getsockopt it remains unchanged.

I am not able to understand the reason. Could someone plsssss help me out

Regards,
Lakshmi