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

Re: [Re: signals ??]



Hi,
   the reason for not receiving the packet ( udp) aren't many .Generally
it would
be one of the following
1. @ server side  1. have you set a well known port for server.
                           2. have you bound the socket with the ipaddr
of the
server
                           3. recvfrom syntax
                           4. try putting recvfrom in a
while(1){recvfrom(.....);sleep(1);}loop    at server

2. @client side    1. are you sending the packets to the same well known
server
addr with the
                              correct "well known" port number.

   well if you still dont recv packets then the problem is not usual may
be then i
could have a look at your code.

I checked up with global vars they vary separately in child and parent
so i guess
static global variables should do the same.anybody any comments


hoping to hear
Pradeep Kanwar
ps: as far as printf goes we have had a discussion over it a little time
ago in
this list.Well if you missed it then you could pick it up from archives.

nitin mahajan wrote:

> Hello ,
>
> Oh ! thanx for correcting me .. got the point .. i was just wondering that yes
> global variables would have 2 copies but cannot the problem be solved by using
> static global variables .
> and yea i was facing a strange problem that my programm (simple UDP
> sockets)was opening ports well (netstat -a)and even when sendto () calls were
> returning >0 , the datagrams were not being recvd at other end of LAN ..any
> idea for what i might be bungling up ? and yea you were correct about printf
> in signals .. but isn't it asking for too much when it doesn't prints for if u
> don't print /n at end .
>
> thanx a lot again :)
> Luv,
> Nitin
>
> "Prateek Gera" <prateekg@xxxxxxxxxxxxxxx> wrote:
> Hi ,
> 1.     The signal that you intend to send (SIGUSR1) to the child is not
> lost but ignored because the fork has not occured yet and there is no child
> process and the main process ignores it because of SIG_IGN. After you
> create a child process , nowhere do you send a signal(SIGUSR1)  to the
> child. The value "int_occured2" is never incremented and your child process
> enters an infinite loop printing  "nahi main nahin maanonga" infinitely.
> 2. The printf inside the "handler"  fn will be printed if you use the
> newline correctly ie., \n .
> 3. There are some other mistakes also in your program, I've rectified your
> code , please see the attached file.
> (See attached file: signals.c)
>
> HTH
> prateek
>
> ____________________________________________________________________
> Get free email and a permanent address at http://www.netaddress.com/?N=1
>
> -----------------------------------------------------------------------
> For information on this and other Linux India mailing lists check out
> http://lists.linux-india.org/