Quote:
|
Can u tell me, how can i find hostname in "sender <hostname> <message>"
|
I'm not sure what you mean here.
Here's what I did.. On one machine I typed "/server" for the "receiver" end. This is the program built from your "server.c" source code.
On another I ran "/client 192.168.1.6 'Hello from client' " where 192.168.1.6 is the IP of the machine running the server program. Note that the message needs enclosing in quotes or the client program errors out. For me this works between machines or between terminals on the same machine using localhost as the hostname.
To try and replicate your setup I have also tried running this in a Linux Virtual machine inside VMWare. This too works fine. I have the VM set to use bridged networking and it gets it's own unique IP via DHCP from the network DHCP server. In effect this means the VM just looks like another workstation on the network. I can run two such VM's and communicate between both using your programs or between the host and the VM's.
If you wish to find the IP of the Ubuntu VM you can run "ifconfig". You may use this as the hostname for the programs.
Before you worry about two networked machines passing messages via your code I would try pinging each one from the other one to make sure they can see each other across the network and that your IP's are correct.