Hi,
I am facing 2 problems in Linux 2.2.16-22:
[1] In the server program (tmgr_main1.c) attached herewith, i am waiting on
events on the select system call on 3 sockets.
First I run the server program and its 3 client programs. If do a sendto in
this program just before waiting for select or do a sendto in response to read
events received by select, the message sent goes to the respective client and
the programs work perfectly fine.
However If i run only the server and do not run the client programs, then the
sendto done in the server program sends a message/event to the server itself (
which is waiting on events on that sockfd also) .
When i tried the above thing on SunOS 5.5.1 it worked perfectly fine!
(See attached file: server.c)
The output of this program is as follows:
[npunmia@msatpd1 tm1]$ ./a.out
In Test Manager main function !
Signal Handler installed!
Message sent to MRS!
Waiting on select system call....
Data received from MRS!
Error in receive!
Servicing a MRS request!
Message received =
€?c
Waiting on select system call....
Shutting down the test manager!
[npunmia@msatpd1 tm1]$
[2] The second problem occurs when i do a sendto 2 or more times in this server
program. This time also I run only the server and do not run the
destination/clients programs. The point to note here is that i get a Connection
Refused error every second time i do a sendto! The first time the message is
sent correctly to the client , the second time i get Connection Refused error ,
third time the message is sent correctly to the client, and so on.
(I have commented the second sendto before select . To try problem no. 2 you
can remove the comments and run it)
a) Why am i not getting a connection refused error consistently every time
i do a sendto?
b) Why at all am i getting a connection refused error in UDP in the first
place??
c) When i try the above thing on SunOS, the message is sent from the server
correctly every time, even though the client processes are not alive and i do
not get any error!!!
The output on running the above program(remove the comments from the second
sendto before select) is as follows:
[npunmia@msatpd1 tm1]$ ./a.out
In Test Manager main function !
Signal Handler installed!
Message sent to MRS!
Error in send to MRS
Error: Connection refused
Waiting on select system call....
Shutting down the test manager!
[npunmia@msatpd1 tm1]$
Regards,
Niraj Punmia,
Software Engineer,
Hughes Software Systems,
Plot 31, Sector 18,
Gurgaon- 122 015,
Haryana, India.
Off: 0124-6346666. Extn 2350.
server.c