Help solve the problem of program exit-Linux general technology-Linux technology and application information. The following is a detailed description. Server:
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Define MYPORT 4000
# Define BACKLOG 2
Char bye [] = "exit ";
Struct
{
Int sock_fd;
Int client_fd;
Pthread_t sen_tidp;
Pthread_t rev_tidp;
} Pid;
Void * rev_msg (void * arg)
{
Int * sock_fd;
Int num, OK;
Char buf [1024];
Num = strlen (buf );
Write (* sock_fd, buf, num );
OK = 0;
Do
{
Scanf ("% s", & buf );
Num = strlen (buf );
Write (* sock_fd, buf, num );
If (strncasecmp (buf, bye, 4) = 0)
OK = 1;
} While (! OK );
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.