Linux socket programming is urgent-Linux general technology-Linux technology and application information. The following is a detailed description. // This is network socket programming
// This is the server side
# Include
# Include
# Include
# Include
# Include
# Include
# Define oops (ch) {perror (ch); return 0 ;}
Int main ()
{Int server_sockfd, client_sockfd;
Int server_len, client_len;
Struct sockaddr_un server_address;
Struct sockaddr_un client_address;
If (write (sockfd, & ch, 1) =-1) // The program seems to be blocked here. Why !?
Oops ("write ");
Sleep (2 );
Read (sockfd, & ch, 1 );
Printf ("char from server = % c \ n", ch );
Close (sockfd );
Return 0;
}
I don't understand how to run the client after running the server.
Why does the program block write when running the client ??
Urgent!
Thank you!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service