Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jan : Sending Message to IP and Port
| Subject: | Sending Message to IP and Port |
| Posted by: | "Isaac Alexander" (isaacnospam@gonospamprocura.com) |
| Date: | Thu, 25 Jan 2007 16:15:36 |
I am using D7 and I'm trying to send an HL7 message (text message) to a
specific IP and port.
I've been using Delphi since Delphi 2, but I've never attempted to send a
"message" to a port.
I fumbled my way through and found the TUdpSocket component.
Is this the right component to use? Is there a better one that comes with
Delphi 7?
I am getting a 10038 error. I have a listener app installed locally on my
computer. I have the TUdpSocket.LocalHost, TUdpSocket.LocalPort,
TUdpSocket.RemoteHost, TUdpSocket.RemotePort set to my internal IP and the
listener port's IP.
Here is the code I am using to test it.
procedure TForm1.Button1Click(Sender: TObject);
var
TempResult : integer;
TempStream : TStringStream;
begin
TempStream := TStringStream.Create('test');
TempResult := UdpSocket1.SendStream(TempStream);
TempStream.Free;
MessageDlg('Result = ' + IntToStr(TempResult), mtError, [mbOK], 0);
end;
procedure TForm1.UdpSocket1Error(Sender: TObject; SocketError: Integer);
begin
MessageDlg('Error = ' + IntToStr(SocketError), mtError, [mbOK], 0);
end;
I am brand new to this, so bare with me.
Thanks.