[Csci551-talk] The problem is persisting!
rashmi chandrasekhar
rmchandr at usc.edu
Tue Mar 15 14:08:32 PST 2005
Yash,
I faced the same problem and I am not sure if you saw my earlier email about problem with fork, but the solution to that applies to this as well. Check if you have a return statement from the forked client. If so, remove it. It is natural to think that a return from a client would return to the parent process, but this is not the case .. also, check and ensure that you have the structure definitions etc declared and initialized outside of the client (I mean outside of the "if fork returns 0" block). I did this and it worked for me.
-Rashmi.
----- Original Message -----
From: yash gandhi <ygandhi at usc.edu>
Date: Tuesday, March 15, 2005 12:39 pm
Subject: Re: [Csci551-talk] The problem is persisting!
> Hey!!
> Even I am facing the same problem,
> i have tried every thing mentioned befor in the thread
> I even tried allocating memory everytime,
> but the problem persists,
> I get the udp ports as 0... all thetime.
> comments!!!!!!!!!!!!!!
> Yash Gandhi
>
> ----- Original Message -----
> From: "S. Lugani" <lugani at usc.edu>
> Date: Monday, March 14, 2005 10:12 pm
> Subject: [Csci551-talk] The problem is persisting!
>
> > Hi,
> >
> > The problem is persisting even with that
> > if I do:-
> > nodeadd.sin_port = htons(0);
> > then I bind the socket, after that call getsockname() and try
> and
> > display the port of the fork process. It shows the port as 0. I
> am
> > not being able to assign dynamic ports to the forked children.
> >
> > thanks for ur help.
> > Sam
> >
> > ----- Original Message -----
> > From: affan syed <asyed at usc.edu>
> > Date: Monday, March 14, 2005 10:22 am
> > Subject: Re: RE: RE: [Csci551-talk] format of file:trailing
> white
> > spaces?
> > >
> > > Have you tried to set your nodeadd.sin_port =0 before using
> socket?> >
> > > Affan
> > > ----- Original Message -----
> > > From: "S. Lugani" <lugani at usc.edu>
> > > Date: Monday, March 14, 2005 8:46 am
> > > Subject: Re: RE: RE: [Csci551-talk] format of file:trailing
> > white
> > > spaces?
> > > > Hi Affan,
> > > >
> > > > There was one more problem
> > > > My problem is that when I fork multiple clients to a
> function
> > > and
> > > > try to give them each of them dynamic ports. It does create
> a
> > > port
> > > > number and assigns them that BUT it assigns the same port
> > number
> > > to
> > > > all the fork children created. eg. I fork 10 chilren and and
> > do
> > > the
> > > > getsocketname on them and they all have the same ports.
> > > Shouldn't
> > > > it assign a different port to each child when i use the
> > socket()
> > > > function??
> > > > This is the pseudo code:-
> > > > void childnode(int nodeid,int tracker_port)
> > > > {
> > > > node_socket = socket(AF_INET,SOCK_DGRAM,0);
> > > > getsockname(node_socket,(struct sockaddr
> > *)&nodeadd,sizeof(nodeadd));> node_port=htonl(nodeadd.sin_port);
> > > > printf("myport %d",node_port);
> > > > }
> > > >
> > > > main()
> > > > {
> > > > for (;;)
> > > > {
> > > > pid_t pid;
> > > > pid=fork();
> > > > if(pid == 0)
> > > > {
> > > > childnode(x,y);
> > > > }
> > > > }
> > > >
> > > > thanks
> > > > Sam
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Affan, Syed" <asyed at usc.edu>
> > > > Date: Monday, March 14, 2005 6:22 am
> > > > Subject: RE: RE: [Csci551-talk] format of file:trailing
> white
> > > spaces?>
> > > > > Yes, you can assume that.
> > > > >
> > > > > Best Regards,
> > > > > Affan, Syed.
> > > > >
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: csci551-talk-bounces at mailman.isi.edu
> > > > > [csci551-talk-bounces at mailman.isi.edu] On Behalf Of S. Lugani
> > > > > Sent: Sunday, March 13, 2005 10:15 PM
> > > > > To: csci551-talk at mailman.isi.edu
> > > > > Subject: Re: RE: [Csci551-talk] format of file:trailing
> > white
> > > > spaces?>
> > > > >
> > > > > Hi affan,
> > > > >
> > > > > I have assumed in my file that the correct input lines
> will
> > > NOT
> > > > START> with blank space. Though they might have multiple
> > spaces
> > > > between the
> > > > > variables. Am i correct in assuming that? eg.
> > > > > 1 5 6 is correct
> > > > > but
> > > > > 1 5 6 is not
> > > > >
> > > > > thanks
> > > > > Sam
> > > > >
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Affan, Syed" <asyed at usc.edu>
> > > > > Date: Sunday, March 13, 2005 9:55 pm
> > > > > Subject: RE: [Csci551-talk] format of file
> > > > >
> > > > > > Rashmi, you are correct. We will not be altering the
> order
> > > of the
> > > > > > inputbut their might be trailing whitespace that you
> need
> > to
> > > > > > handle.
> > > > > >
> > > > > > Best Regards,
> > > > > > Affan, Syed.
> > > > > >
> > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: csci551-talk-bounces at mailman.isi.edu
> > > > > > [csci551-talk-bounces at mailman.isi.edu] On Behalf Of
> rashmi
> > > > > > chandrasekhar
> > > > > > Sent: Sunday, March 13, 2005 8:26 PM
> > > > > > To: lubaina kitabi
> > > > > > Cc: csci551 spring
> > > > > > Subject: Re: [Csci551-talk] format of file
> > > > > >
> > > > > >
> > > > > > Lubaina,
> > > > > >
> > > > > > What the spec means is that the format is fixed, I mean
> > > number
> > > > > of
> > > > > > clients will always come before timeout. What can vary
> is
> > > the
> > > > > > comments,the blank spaces, newlines. Also, the columns
> > will
> > > not
> > > > > get
> > > > > > interchanged, neither will additional columns be added.
> > When
> > > > > they say
> > > > > > "you should assume that the data fields that we provide
> > will
> > > > > vary", I
> > > > > > think they mean the number of entries. Correct me if I
> am
> > wrong.> > > >
> > > > > > -Rashmi.
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: lubaina kitabi <kitabi at usc.edu>
> > > > > > Date: Sunday, March 13, 2005 8:16 pm
> > > > > > Subject: [Csci551-talk] format of file
> > > > > >
> > > > > > > Hi,
> > > > > > > I just wanted to know that when you say the file
> format
> > > is
> > > > > > > variable, you mean the number of whitespaces and new
> > lines
> > > only> > > or
> > > > > > > also could you change the order . By that I mean would
> > you put
> > > > > > > "number of clients" data before "request timeout in
> > > seconds
> > > > "
> > > > > > and
> > > > > > > so on so forth. Finally, the project spec also
> mentions "you
> > > > > > > should assume that the data fields that we provide
> will
> > > > > > vary".Does
> > > > > > > this mean the ordering of the columns can also change
> in a
> > > > > > > particular table or that you would add more columns
> or
> > > > > > something
> > > > > > > else that I cannot figure out?
> > > > > > > Thank you,
> > > > > > > Lubaina Kitabi.
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
More information about the Csci551-talk
mailing list