Communication using Sockets

I am trying to make an object (a form command button) that will send a message to an external Web Address, wait for a response and then take action depending upon the response. I will use the Navision Socket Bus Adaptor and Communication Components. I have searched the forum and looked at the devguide.chm but I am not any closer to understanding how or if this could be done. Any ideas or suggestions would be most welcome.

Well, we also use Sockets to receive/process XML files, here some code snippets: Globals ... Name DataType Subtype Length SBA Automation 'Navision Socket Bus Adapter'.SocketBusAdapter CC2 Automation 'Navision Communication Component version 2'.CommunicationComponent InMsg Automation 'Navision Communication Component version 2'.InMessage DOM Automation 'Microsoft XML, v3.0'.DOMDocument30 //CC2 is "WithEvents" ... ---------------snip--------------- Function InitInterface() IF NOT ISCLEAR(CC2) THEN CREATE(CC2); IF NOT ISCLEAR(SBA) THEN CREATE(SBA); WITH Setup DO BEGIN TESTFIELD(Address); TESTFIELD(Port); CC2.AddBusAdapter(SBA,Priority); SBA.Address := Address; SBA.OpenSocket(Port,'TCP'); END; ---------------snip--------------- Trigger CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH") // Here actually some local functions are called to process the "InMessage" // In our case the "InMsg" is loaded into the XMLDOM Id := ''; Reason := ''; InMsg := InMessage; Result := HandleMessage; GetReason; SendReply; Hope this helps a littel …

Thanks Joerg this helps I have a question that bothers me. After I send my message to the external Web address, how can I keep my object ‘alive’ until the reply comes back?

Sorry, I did not mention that previously: the codeunit that is doing this job is a “SingleInstance” one, run by a NAS, so it’s actually permanently “listening” on the port …