Abhishek KumarSoni wrote:
This was my server code
...........
I execute server code and after that client code
output printed was -> my port is 52340 .
Why this unexpected behaviour??It should be -> my port is 4001?
Hint : Which socket is the variable sock pointing to? Is the port number of that socket 4001?
As an aside, you might want to consider renaming your class 'client' to 'Client' and class 'server' to 'Server'. I guess you already know why.