发送一个记录数据包
2010-09-18 00:53
316 查看
1.服务器端:
type
TMSG001 = Packed Record //定义记录类型
userId: array[0..19] of char;
password: array[0..17] of char;
end;
PSendMSG=^TMSG001;//定义指针类型
var
pSend: PSendMSG;//定义指针
pSend^.userId := '001';//生成要发送数据
pSend^.password := '001';
_SocketS.Socket.Connections[i].SendBuf(pSend^, sizeof(TMSG001)); //发送数据
2.客户接收
type
TMSG001 = Packed Record //定义记录类型
userId: array[0..19] of char;
password: array[0..17] of char;
end;
PRecvMSG= ^TMSG001;
var
pRecv: PRecvMSG;
Socket.ReceiveBuf(pRecv^, SizeOf(TMSG001));
xxx := pRecv.userid;
xxx := pRecv.password;
如果一个结构体对应数据集中的一条记录,那么定义一个这样的结构体数组即可以对应一个数据集。
type
TMSG001 = Packed Record //定义记录类型
userId: array[0..19] of char;
password: array[0..17] of char;
end;
PSendMSG=^TMSG001;//定义指针类型
var
pSend: PSendMSG;//定义指针
pSend^.userId := '001';//生成要发送数据
pSend^.password := '001';
_SocketS.Socket.Connections[i].SendBuf(pSend^, sizeof(TMSG001)); //发送数据
2.客户接收
type
TMSG001 = Packed Record //定义记录类型
userId: array[0..19] of char;
password: array[0..17] of char;
end;
PRecvMSG= ^TMSG001;
var
pRecv: PRecvMSG;
Socket.ReceiveBuf(pRecv^, SizeOf(TMSG001));
xxx := pRecv.userid;
xxx := pRecv.password;
如果一个结构体对应数据集中的一条记录,那么定义一个这样的结构体数组即可以对应一个数据集。
相关文章推荐
- WinPcap编程0x0300 发送一个数据包
- 编写一个Windows服务程序,定时从数据库中拿出记录发送邮件
- CC2640 一个连接事件发送10个数据包
- 外网主机怎样将数据包发送到共用一个公网IP的局域网某特定主机上的
- 网络编程——设计一个发送TCP数据包的程序
- 记录一个SmsManager发送短信的问题
- 网络编程——设计一个发送TCP数据包的程序
- C# 一个类用来将结构体或类中的数据打成"数据包",进行网络发送
- 在cron启动定时任务后总是会启动一个[sendmail] 进程的解决方法, 并且每次cron任务之后msmtp.log总是记录一条发送失败的日志
- TCP、UDP数据包大小的限制(UDP数据包一次发送多大为好)——数据帧的物理特性决定的,每层都有一个自己的数据头,层层递减
- NS 发送一个 cbr 数据包的过程
- 外网主机如何将数据包发送到共用一个公网IP的局域网某特定主机上的
- 外网主机怎样将数据包发送到共用一个公网IP的局域网某特定主机上的
- PC到PC之间怎么传送数据包?包括一个路由器,一个交换机,2台PC,由PCA发送经过交换机,路由器到PC2
- 记录一个读pcap数据包的软件:Fiddler
- 编写一个C#Windows服务程序,定时从数据库中拿出记录发送邮件。
- C# 自己写的一个类,用来将结构体或类中的数据打成"数据包",进行网络发送(转载)
- 腾讯云图片鉴黄集成到C# SQL Server 怎么在分页获取数据的同时获取到总记录数 sqlserver 操作数据表语句模板 .NET MVC后台发送post请求 百度api查询多个地址的经纬度的问题 try{}里有一个 return 语句,那么紧跟在这个 try 后的 finally {}里的 code 会 不会被执行,什么时候被执行,在 return 前还是后? js获取某个日期
- C# 自己写的一个类,用来将结构体或类中的数据打成"数据包",进行网络发送
- 怎么把一个结构体的数据包通过串口发送出去?