BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help,UDPSOCKET!

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
joy
Guest





PostPosted: Wed Oct 12, 2005 3:24 am    Post subject: help,UDPSOCKET! Reply with quote



hi,I have wirte following code:
//============================
procedure TForm1.BitBtn1Click(Sender: TObject);
var ss:tmemorystream ;
tt:string;

begin
tt:=edit1.text;

ss:=tmemorystream.create;
ss.Write(tt[1],length(edit1.text));
udpsocket1.RemoteHost:='127.0.0.1';
udpsocket1.RemotePort:='8888';
udpsocket1.Connect;
udpsocket1.SendStream(ss);


end;

procedure TForm1.UdpSocket1Receive(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
begin
showmessage('o');
end;

procedure TForm1.UdpSocket1Connect(Sender: TObject);
begin
showmessage('connected');
end;

procedure TForm1.UdpSocket1Send(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
begin
showmessage('onsend');
end;


When I click the bitbtn1 to send the string ss,but udpsocket1.onreceive
event are not occurs!

does anybody know?
Thanks a lot!




Back to top
Francois Piette [ICS & Mi
Guest





PostPosted: Wed Oct 12, 2005 7:54 am    Post subject: Re: help,UDPSOCKET! Reply with quote



I'm not sure about which component you use, but anyway, I don't see in your
code that you put a sicket in listening mode to receive data.

I suggest you use TWSocket. Download full source code from
http://www.overbyte.be and look at the demos UdpSend and UdpRecv.

--
Contribute to the SSL Effort. Visit
http://www.overbyte.be/eng/ssl.html
--
[email]francois.piette (AT) overbyte (DOT) be[/email]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be



"joy" <joyshm (AT) sohu (DOT) com> a 閏rit dans le message de
news:434c8154 (AT) newsgroups (DOT) borland.com...
Quote:
hi,I have wirte following code:
//============================
procedure TForm1.BitBtn1Click(Sender: TObject);
var ss:tmemorystream ;
tt:string;

begin
tt:=edit1.text;

ss:=tmemorystream.create;
ss.Write(tt[1],length(edit1.text));
udpsocket1.RemoteHost:='127.0.0.1';
udpsocket1.RemotePort:='8888';
udpsocket1.Connect;
udpsocket1.SendStream(ss);


end;

procedure TForm1.UdpSocket1Receive(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
begin
showmessage('o');
end;

procedure TForm1.UdpSocket1Connect(Sender: TObject);
begin
showmessage('connected');
end;

procedure TForm1.UdpSocket1Send(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
begin
showmessage('onsend');
end;


When I click the bitbtn1 to send the string ss,but udpsocket1.onreceive
event are not occurs!

does anybody know?
Thanks a lot!





Back to top
Jeremy Darling
Guest





PostPosted: Wed Oct 12, 2005 12:23 pm    Post subject: Re: help,UDPSOCKET! Reply with quote

It would greatly help if you would give all infomration pretaining to your
project. Version of Delphi, Product name used, Version of product. This
looks like Indy code, but I can't be certain as it would be a very old
version of Indy.

Jeremy

"joy" <joyshm (AT) sohu (DOT) com> wrote

Quote:
hi,I have wirte following code:
//============================
procedure TForm1.BitBtn1Click(Sender: TObject);
var ss:tmemorystream ;
tt:string;

begin
tt:=edit1.text;

ss:=tmemorystream.create;
ss.Write(tt[1],length(edit1.text));
udpsocket1.RemoteHost:='127.0.0.1';
udpsocket1.RemotePort:='8888';
udpsocket1.Connect;
udpsocket1.SendStream(ss);


end;

procedure TForm1.UdpSocket1Receive(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
begin
showmessage('o');
end;

procedure TForm1.UdpSocket1Connect(Sender: TObject);
begin
showmessage('connected');
end;

procedure TForm1.UdpSocket1Send(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
begin
showmessage('onsend');
end;


When I click the bitbtn1 to send the string ss,but udpsocket1.onreceive
event are not occurs!

does anybody know?
Thanks a lot!




Back to top
Ben Taylor [Team Indy]
Guest





PostPosted: Wed Oct 12, 2005 12:33 pm    Post subject: Re: help,UDPSOCKET! Reply with quote

Quote:
ss:=tmemorystream.create;
ss.Write(tt[1],length(edit1.text));
udpsocket1.RemoteHost:='127.0.0.1';
udpsocket1.RemotePort:='8888';
udpsocket1.Connect;
udpsocket1.SendStream(ss);

without seeing the rest of your code, it looks like you may just need to
set
ss.position:=0;
before trying to send it

Back to top
joy
Guest





PostPosted: Mon Oct 17, 2005 2:56 pm    Post subject: Re: help,UDPSOCKET! Reply with quote

Thanks a lot for everybody's answer!
I am a newbie!
I use delphi7 ,and Tudpsockt in internet group!


"joy" <joyshm (AT) sohu (DOT) com> 写入消息新闻:434c8154 (AT) newsgroups (DOT) borland.com...
Quote:
hi,I have wirte following code:
//============================
procedure TForm1.BitBtn1Click(Sender: TObject);
var ss:tmemorystream ;
tt:string;

begin
tt:=edit1.text;

ss:=tmemorystream.create;
ss.Write(tt[1],length(edit1.text));
udpsocket1.RemoteHost:='127.0.0.1';
udpsocket1.RemotePort:='8888';
udpsocket1.Connect;
udpsocket1.SendStream(ss);


end;

procedure TForm1.UdpSocket1Receive(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
begin
showmessage('o');
end;

procedure TForm1.UdpSocket1Connect(Sender: TObject);
begin
showmessage('connected');
end;

procedure TForm1.UdpSocket1Send(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
begin
showmessage('onsend');
end;


When I click the bitbtn1 to send the string ss,but udpsocket1.onreceive
event are not occurs!

does anybody know?
Thanks a lot!




Back to top
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
 


Powered by phpBB © 2001, 2006 phpBB Group
.