in reply to Re: Socket deadlock doubt in code
in thread Socket deadlock doubt in code

Hi

Thanks for the reply. I have done the required changes. Now, the new code is working fine. But couple of issues are there.

This is how it is, I have taken some information from client side and now I am doing some manipulations and have a IF condition.

In this IF condition I have sent some information to client back, it works perfectly fine. But, when i tried to print something in this IF condition, it doesn't print anything, but the information in IF condition is sent successfully to the client.

I am not able to understand this issue ?

Replies are listed 'Best First'.
Re^3: Socket deadlock doubt in code
by sajanagr (Acolyte) on Jun 23, 2010 at 09:18 UTC
    Also, my gethostbyaddr function is not working here. It is failing to give me client's hostname. Works fine with same machine as server-client.

    The entries in /etc/hosts and /etc/resolv.conf are perfectly fine connected to the same domain.

      gethostbyname relies on a functioning DNS system. Make sure things like nslookup and traceroute work properly. The other place you might be going wrong is that in a scalar context, gethostbyname returns the packed ip address, though I'm not sure why you're looking up the hostname from a hostname to begin with.

      As for the printing issue, I suspect that you are Suffering from Buffering.

      Update: oops, gethostbyname is irrelevant here but the DNS still needs to work.

        Hi

        I am using gethostbyaddr here at server's code to get the client's hostname. You can check the code in the first thread for the procedure.

        I am doing this to find out which client has connected to the server.

        I am tracking the issue for the DNS right now, since the current setup is between two VM machines.