客户端: struct ST{ int a; int b; }; ST st; st.a = 0xe1; st.b = 90; char *tmp = (char*)&st; tcp的write函数将tmp发出 服务器端: tcp的read函数到pBuf struct ST{ int a; int b; }; ST *tmpw = (ST*)pBuf; printf("收到:%x %x 解析:%d %d \n",tmpw->b,tmpw->a,tmpw->b,tmpw->a); 解析数据有错误是什么情况啊,是不是大端小端的问题 ,具体怎么解决啊~!!
本帖最后由 computerzanz 于 2011-12-17 11:07 编辑 可能不该发在这个版里,版主见谅 windows server端有个结构体[code]#pragma pack(push, 1) struct data { int a; char b[100]; bool c; ...... } #pragma pack(pop)[/code]linux client相同的结构体[code]typedef struct data { int a; char b[100]; bool c; ...... } __attribute__((packed)) mytype_t;[/code]windows server 调用send...
[code]#!/usr/bin/python # -*- coding: utf-8 -*- import psutil from pprint import pprint def main(): pl=psutil.get_pid_list() r=[] for pid in pl: try: p=psutil.Process(pid) r.append((pid,p.name,int(p.get_cpu_percent()))) except: pass pprint(r) if __name__ == '__main__': main()[/code]获取到的结果一个天一个地
@exec("ipconfig /all",$array); print_r($array);exit; for($Tmpa;$Tmpa 执行结果 Array ( [0] => [1] => windows IP Configuration [2] => [3] => Host Name . . . . . . . . . . . . : tianwu [4] => Primary Dns Suffix . . . . . . . : [5] => Node Type . . . . . . . . . . . . : Unknown [6] => IP Routing Enabled. . . . . . . . : No [7] => WINS Proxy Enabled. . . . . . . . : No [8] => DNS Suffix Search List. ...