Skip to Content
0
Oct 21, 2020 at 02:06 PM

Create a tcp connection

50 Views

I am using this code to create a class managing the connections to devices available with telnet.
I am following this

https://help.sap.com/viewer/05d041d3df1a4595a3c45f57c15e2325/7.52.6/en-US/fb4c69f8c58644598b7240f2c825d064.html

  
  DATA: lo_client          TYPE REF TO if_apc_wsp_client,
        lo_event_handler   TYPE REF TO ZMY_OWN_APC_HANDLER,
        port    TYPE string,
        lv_frame           TYPE apc_tcp_frame.
  
            lv_frame-frame_type = if_apc_tcp_frame_types=>co_frame_type_terminator. 
            lv_frame-terminator = '0A'. " 


  lo_client = cl_apc_tcp_client_manager=>create( i_host = me->host " 10.X.X.X
      i_port = port " '20000'
      i_frame = lv_frame
      i_event_handler = lo_event_handler
  )

I have an error

Creation of APC client object has failed with error text: Argument not found.

OTR-Based Exception of Class: CX_APC_WSP_CLIENT_ERROR

It seems that this error comes from cl_http_client=>create_by_url

I checked the code of cl_apc_tcp_client_manager I find that it create lo_apc_client of type cl_apc_wsp_client which try to create a http client ( cl_http_client=>create) which fail raising cx_apc_wsp_client_error with textid : cx_apc_wsp_client_error=>client_create_failed. I was wondering if there is a way to create a tcp connection not related to Web Socket.

Is cl_apc_tcp_client_manager the right tool to create tcp connexion ?

What would you use to create tcp connection ?

Thank you