procedure TFormTCPUDP.BtnSendClick(Sender: TObject);
var SEND_PACKAGE : TUDPaction;
//数据发送
i:integer;
s,s1:String;
begin
Fillchar(SEND_PACKAGE.data,Data_Length,chr(0));
SEND_PACKAGE.data[0]:='1';
SEND_PACKAGE.data[1]:='2';
SEND_PACKAGE.data[2]:='3';
SEND_PACKAGE.opcode:=2;
SEND_PACKAGE.index:=PackageID;
SEND_PACKAGE.Command:=3;
s:=editsend.
Text;
for i:=0 to length(EditSend.
Text)-1do
SEND_PACKAGE.data:=s[i+1];
PackageID:=PackageID+1;
if not (Tcpflag and Serverflag) then
sendto(AcceptSock[0], SEND_PACKAGE,sizeof(SEND_PACKAGE), 0, FSockAccept[0], sizeof(FSockAccept[0]))
else
if AcceptNum=0 then
Application.MessageBox('没有一个客户端和您建立连接','信息提示',MB_OK)
else
begin
i:=pos(' ',CmbSendto.Text);
if i>0 then
begin
i:=strtoint(MidStr(CmbSendTo.Text,13,13));
// i=192.168.0.156
sendto(AcceptSock, SEND_PACKAGE,sizeof(SEND_PACKAGE), 0, FSockAccept, sizeof(FSockAccept));
// sendto(AcceptSock[0], SEND_PACKAGE,sizeof(SEND_PACKAGE), 0, FSockAccept[0], sizeof(FSockAccept[0]));
end
else
Application.MessageBox('您没有选择发送方','错误提示',MB_OK);
end;
// sendto(AcceptSock[0], NbtstatPacket,50, 0, FSockAccept[0], sizeof(FSockAccept[0]));
end;