S
shenfeng_126
Unregistered / Unconfirmed
GUEST, unregistred user!
我现在与unix系统进行通讯,
IP:192.168.0.1
port :6000
我的程序通讯如下:
var
MyHost,MyPort:string;
s:tsocket;
error:integer;
server:tsockaddrin;
num :integer;
//str :array of string[10];
begin
s:=socket(AF_INET, SOCK_STREAM, 0);
server.sin_addr.S_addr:=inet_addr(('192.168.0.1'));
server.sin_port:=6000;//htons(MyPort);
server.sin_family:=AF_INET;
error:=connect(s,server,sizeof(server));
if error=0 then
showmessage('连接成功');
//str[0] :='aaa' ;
num := send(s,str,sizeof(str),0);
但是没有成功,请问怎么写?
IP:192.168.0.1
port :6000
我的程序通讯如下:
var
MyHost,MyPort:string;
s:tsocket;
error:integer;
server:tsockaddrin;
num :integer;
//str :array of string[10];
begin
s:=socket(AF_INET, SOCK_STREAM, 0);
server.sin_addr.S_addr:=inet_addr(('192.168.0.1'));
server.sin_port:=6000;//htons(MyPort);
server.sin_family:=AF_INET;
error:=connect(s,server,sizeof(server));
if error=0 then
showmessage('连接成功');
//str[0] :='aaa' ;
num := send(s,str,sizeof(str),0);
但是没有成功,请问怎么写?