由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - One network C question
相关主题
pollsys 是干嘛的?c++ template中如何判断类型
Cannot recvfrom() on ipv6, HELP!code question
用INADDR_ANY 怎么才能看出destination IP?请教用Mathematica输出mesh数据 (转载)
C & C++ mixing question[合集] Why it only write the file once?
关于fscanf格式化读取的问题.MPI I/O 问题
又一个GDB的问题:关于显示数据求个好方法
fprintf in C\C++大家帮我看看C文件输入函数fprintf的问题
c的文件写入问题搜狐一题,寻解法
相关话题的讨论汇总
话题: struct话题: cn话题: network话题: unsigned话题: recvfrom
进入Programming版参与讨论
1 (共1页)
q***z
发帖数: 934
1
Hello I am a newbie on network programming.
I am trying to receive a packet
if((numbytes = recvfrom(udp_fd1, buf, MAXLEN-1, 0,(struct
sockaddr*)®ister_addr, &addr_len))==-1){
fprintf(stderr, "error in recvfrom.\n");
exit(1);
}
The packet I am receiving has the following possible structure.
typedef struct struct_CN
{
unsigned char magicA;
unsigned char magicB;
unsigned short msgLen;
} CN;
typedef struct struct_Cc
{
CN msgHeader;
uns
n******t
发帖数: 4406
2
How do you send the structure,
generally you can not send raw C structure on
network. Better encode it to a network message
and send it.

【在 q***z 的大作中提到】
: Hello I am a newbie on network programming.
: I am trying to receive a packet
: if((numbytes = recvfrom(udp_fd1, buf, MAXLEN-1, 0,(struct
: sockaddr*)®ister_addr, &addr_len))==-1){
: fprintf(stderr, "error in recvfrom.\n");
: exit(1);
: }
: The packet I am receiving has the following possible structure.
: typedef struct struct_CN
: {

1 (共1页)
进入Programming版参与讨论
相关主题
搜狐一题,寻解法关于fscanf格式化读取的问题.
using gnuplot in c++ question又一个GDB的问题:关于显示数据
求推荐openmp的debuggerfprintf in C\C++
请教一个用matlab tcpip函数的问题c的文件写入问题
pollsys 是干嘛的?c++ template中如何判断类型
Cannot recvfrom() on ipv6, HELP!code question
用INADDR_ANY 怎么才能看出destination IP?请教用Mathematica输出mesh数据 (转载)
C & C++ mixing question[合集] Why it only write the file once?
相关话题的讨论汇总
话题: struct话题: cn话题: network话题: unsigned话题: recvfrom