socket programming

i new to socket programming. i built a chatting software. the program compiles fine but doesn't work as expected. Please help.

Last edited on
Since I don't want to go get a second computer to compile and run this on, would you mind telling us what it isn't doing correctly?
Why do you have two sockets?

You can't use zero for the protocol in:
 
socket(AF_INET, SOCK_STREAM, 0);
You have to specify a value, probably IPPROTO_TCP on Windows.

You don't set the address size in:
 
accept(sockfd, (struct sockaddr *)&their_addr, &sin_size);

The rest isn't readable, you need to use the code format tags to format the code.
Last edited on
when i run two instances of this program one for listening and the other for connecting, the listening one doesn't seem to be connected. more over both the connect() statements reurn the value 0.
Then when i type in something in conneting one instance and it keeps on waiting for the reply from the listening side.
You haven't answered my question above. Why do you have two sockets?

Without formatting your code with code tags, it remains unreadable. You have other code errors too, but they're not obvious because of the formatting.
ok friends i got the errror....
thanks
Topic archived. No new replies allowed.