Socket编程急问。 ( 积分: 200 )

  • 主题发起人 主题发起人 wynney
  • 开始时间 开始时间
W

wynney

Unregistered / Unconfirmed
GUEST, unregistred user!
Const
Buf:array[0..90] of byte =
($76, $76, $64, $75, $7A, $76, $66, $75, $76, $76,
$49, $55, $72, $59, $77, $5B, $3C, $4E, $52, $61,
$44, $5D, $66, $77, $76, $76, $71, $75, $76, $76,
$66, $75, $55, $79, $4C, $5E, $6F, $3F, $49, $44,
$50, $4F, $3F, $77, $3F, $55, $59, $70, $6A, $4F,
$67, $79, $48, $60, $64, $67, $69, $74, $4E, $6A,
$73, $61, $67, $6F, $6B, $67, $63, $49, $44, $3D,
$66, $3E, $4B, $50, $49, $3B, $71, $76, $66, $75,
$46, $3B, $74, $76, $76, $74, $66, $75, $76, $76,
$45);


implementation

{$R *.dfm}

procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
i:Integer;
begin
Memo1.Lines.Add(ServerSocket1.Socket.ReceiveText);
if ServerSocket1.Socket.ReceiveLength = 91 then
begin
ServerSocket1.Socket.Connections[0].SendBuf(Buf,sizeof(Buf));
end;
end;

ServerSocket1.Socket.Connections[0].SendBuf(Buf,sizeof(Buf));
为什么这一行调试不通过啊
 
有什么提示错误吗? 是不是常量不能发送出去??
 
没错误提示,就是在Delphi中调试不过
提示这一行有错误
 
SendBuf 的参数描述要求 (var Buf; Count: Integer),而你使用的是Const 类型变量.
 
tianhf已经给出了正确答案
另外赞一下tianhf清晨答题的大无畏精神:)

情人节快乐
 
ServerSocket1.Socket.Connections[0].SendBuf(Buf,sizeof(Buf));

你以为是vb吗,老大?
 
正确做法,建立个socketArray[]:sSocketRecord,记录每个连接!压入堆栈,最好在附加一些信息!
用的时候检索了发!
 
呵呵,参数类型不匹配阿
 
接受答案 感谢
 
晕 论坛数据库有问题
分数分配不了
 
后退
顶部