b******r 发帖数: 8 | 1 不知道为什么client在二次read的时候,返回值会是-1,它应该是0才对。
谢谢。
./server&
./client username
>>hello
/*server program
run as ./server &
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define MAXHOSTNAME 32
#define PORT 1550
#define SPACE " "
void *manage_client (void *argp);
/*
ABOUT ME
++++++++
I am a sample server, who handles messages from only one client.
I read com |
a***n 发帖数: 262 | 2 where is your read in the client?
【在 b******r 的大作中提到】 : 不知道为什么client在二次read的时候,返回值会是-1,它应该是0才对。 : 谢谢。 : ./server& : ./client username : >>hello : /*server program : run as ./server & : */ : #include : #include
|
b******r 发帖数: 8 | 3 I reassign the value of t
in while loop of client funtion
by t=int(*argv) every loop,
then it works.
seem t becomes 0 after each loop
why?
I use recv for "read"
Thank
【在 a***n 的大作中提到】 : where is your read in the client?
|
n******t 发帖数: 4406 | 4 actually, very simple.
You should not share t among different threads.
【在 b******r 的大作中提到】 : I reassign the value of t : in while loop of client funtion : by t=int(*argv) every loop, : then it works. : seem t becomes 0 after each loop : why? : I use recv for "read" : Thank
|
f******k 发帖数: 26 | 5 oh, netghost, it seems I made the same mistake.
【在 n******t 的大作中提到】 : actually, very simple. : You should not share t among different threads.
|
n******t 发帖数: 4406 | 6 hehe
oh, netghost, it seems I made the same mistake.
【在 f******k 的大作中提到】 : oh, netghost, it seems I made the same mistake.
|