Send string to TCP/IP port

gerbagerba Member Posts: 37
Hi all!

I am already quite desperate :cry:
I cannot find any solution on the web, how to send a String value to a TCP/IP port in Navision.

Has anyone solved that in the past?
If yes, how?

Thanks alot in advance for your help!

Gerald

Comments

  • garakgarak Member Posts: 3,263
    NAV should listen to a port?
    Name	DataType	Subtype	Length
    ComComIn	Automation	'Navision Communication Component version 2'.CommunicationComponent	<-- WithEvents
    SocketBAIn	Automation	'Navision Socket Bus Adapter'.SocketBusAdapter	
    
    //+++++++++++++
    Start(Port : Integer)
    IF ISCLEAR(ComComIn) THEN
      CREATE(ComComIn);
    
    IF ISCLEAR(SocketBAIn) THEN
      CREATE(SocketBAIn);
    
    ComComIn.AddBusAdapter(SocketBAIn,0);
    SocketBAIn.OpenSocket(Port,'');
    //-----------------
    
    
    //+++++++++++++
    ComComIn::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
    
    Name	DataType	Subtype	Length
    InMsg	Automation	'Navision Communication Component version 2'.InMessage	
    
    InMsg:= InMessage;
    insMsg:= InMsg.GetStream();
    insMsg.READ(strMsg);
    message(strMsg);
    InMsg.CommitMessage();
    //-----------------
    

    Is it this what you want?
    Do you make it right, it works too!
  • gerbagerba Member Posts: 37
    No - NAV shall not listen.
    Nav shall just write a String value to a TCP/IP port.

    i.e.:
    IP address is 10.0.0.123 and port is 9100.
    Now I need something like ...

    WriteTo('10.0.0.123:9100', 'This is the string I want to be written to the port');

    Gerald
  • garakgarak Member Posts: 3,263
    U can use Hyperlink(IP:Port) or WSHShell or XMLDom as Automation to Send the String to a port of an IP
    Do you make it right, it works too!
  • gerbagerba Member Posts: 37
    Is it not possible to write directly to the port without using IE or other programs?

    Gerald
  • garakgarak Member Posts: 3,263
    with the OCX "Microsoft WinSock Control" it's also possible.
    But for using this in C/AL develop, you need a VS or VBasic or VC# studio
    U must use 3-rd apps. And when it is using a simlpe vbs script, WSHControl or XMLDom or the WinSock.ocx or the Socket Bus Adapter
    Do you make it right, it works too!
  • DenSterDenSter Member Posts: 8,305
    You can use TCP/IP Sockets if that's what you mean. Find a file on your product disc called "devguide.chm". This explains how to create the right automation for that purpose, and even has code samples.
Sign In or Register to comment.