var
client: tsocket;
pmycontext: pContextKey;
hex: integer;
n: Cardinal;
name: sockaddr_in;
res: longbool;
ret: cardinal;
outBuffer: pchar;
begin
client:=socket(AF_INET,SOCK_STREAM,0); name.sin_family := PF_INET; name.sin_addr.s_addr := inet_addr(PChar('10.183.46.26')); name.sin_port := htons(55962);
connect(client,name,sizeof(name)); GetMem(pmycontext,sizeof(context));
pmycontext^.mysock:=client;
pmycontext^.ovOut.hEvent:= CreateEvent(nil,false,false,nil);
inttohex(1,hex);
pmycontext^.ovOut.hEvent:= (context.ovOut.hEvent or hex);
ret:=CreateIoCompletionPort((pmycontext^.mysock),ghCompletionPort,0,0);//第三個參數應該傳什么
if ret=0 then
begin
showmessage( SysErrorMessage(GetLastError));
end; GetMem(outBuffer,40*sizeof(char));
res:=writefileex( client,outBuffer,4,pmycontext^.ovOut,nil);//出問題了﹐'參數錯誤'
if res=false then
begin
showmessage(SysErrorMessage(GetLastError));
end;
client: tsocket;
pmycontext: pContextKey;
hex: integer;
n: Cardinal;
name: sockaddr_in;
res: longbool;
ret: cardinal;
outBuffer: pchar;
begin
client:=socket(AF_INET,SOCK_STREAM,0); name.sin_family := PF_INET; name.sin_addr.s_addr := inet_addr(PChar('10.183.46.26')); name.sin_port := htons(55962);
connect(client,name,sizeof(name)); GetMem(pmycontext,sizeof(context));
pmycontext^.mysock:=client;
pmycontext^.ovOut.hEvent:= CreateEvent(nil,false,false,nil);
inttohex(1,hex);
pmycontext^.ovOut.hEvent:= (context.ovOut.hEvent or hex);
ret:=CreateIoCompletionPort((pmycontext^.mysock),ghCompletionPort,0,0);//第三個參數應該傳什么
if ret=0 then
begin
showmessage( SysErrorMessage(GetLastError));
end; GetMem(outBuffer,40*sizeof(char));
res:=writefileex( client,outBuffer,4,pmycontext^.ovOut,nil);//出問題了﹐'參數錯誤'
if res=false then
begin
showmessage(SysErrorMessage(GetLastError));
end;
解决方案 »
- 如何对dbgirdeh创建的虚拟的的fkCalculated中的Boolean类型的值进行编辑
- DBGRIDEH 中DATETIME字段录入时出错:'2006-05-10 15:15:01' is not a valid Date!急
- TDX开头的控件是什么控件啊?常用吗?哪里有下啊?还有tcooltrayicon呢?
- 急!!送分啦。。。16进制ASCII码转换成16进制数的问题?
- 哪里有打印条形码的控件?
- SMTP需要验证怎么办?
- 报表第2张开始就打印‘黑板’,百分求援.......
- 怎样从工作站取到服务器注册表的数据?
- 如何在我的程序里面关闭PHOTOSHOP 打开的图片编辑子窗口,而不关闭PHOTOSHOP
- 能不能在程序中显示Flash动画?
- 怎么样才能将客户端的‘临时表’送到服务器(MS-SQL)
- 大侠们,这里是一个文件为Object,应用程序为Observer的问题。
直接用WSARecv等 因为使用完成端口时 对WSARecv这类函数有很好的优化