柳 柳枫 Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-08 #1 我用 Delphi 自带 NMUDP 的控件写个C/S程序,不能发大于255个字节的数据?! 即我传送的数据大于254就出现非法操作,我可以如何解决此问题? 谢了! 柳枫
A ASDC Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-08 #3 procedure TForm1.Button1Click(Sender: TObject); var MyStream: TMemoryStream; C: String; begin C := Edit1.Text; NMUDP1.RemoteHost := '127.0.0.1'; NMUDP1.ReportLevel := Status_Basic; NMUDP1.RemotePort := 6668; MyStream := TMemoryStream.Create; try MyStream.Write(C[1], Length(C));//length(C)不能大于2048,就是2K NMUDP1.SendStream(MyStream); finally MyStream.Free; end; end;
procedure TForm1.Button1Click(Sender: TObject); var MyStream: TMemoryStream; C: String; begin C := Edit1.Text; NMUDP1.RemoteHost := '127.0.0.1'; NMUDP1.ReportLevel := Status_Basic; NMUDP1.RemotePort := 6668; MyStream := TMemoryStream.Create; try MyStream.Write(C[1], Length(C));//length(C)不能大于2048,就是2K NMUDP1.SendStream(MyStream); finally MyStream.Free; end; end;
柳 柳枫 Unregistered / Unconfirmed GUEST, unregistred user! 2004-01-09 #4 谢过! TNMUDP 可以传输图像吗? 如何实现? 。。。 再请教你一个问题? 有什么方法可识别流是文字还是图像? 谢谢!