Skip to main content
Skip table of contents

Socket Read/Write

Objective

Configure SocketAdapter component as Server in synchronous mode and configure it as Client to invoke the server.

Prerequisites

  • Start Fiorano Enterprise Server (FES) and Fiorano Peer Server (FPS)
  • Login to eStudio application
  • Understand the basic menus and perspectives (panels) in eStudio application

Scenario

Create Socket Server with specific Port number and IP address to listen Socket Client data. Server receives the data that is send by Client. Socket Server writes back the data to Socket Client and indicates the successful write-back process through a status message.

Components used

Setting up the Example

Socket Server Configuration

To configure SocketAdapter component for server, perform the following action in eStudio:

  1. Add a new Event Process with name 'SocketRW_Server_Eg'.
  2. Drag the SocketAdapter component from Bridges category in the Micro Service Palette to the Fiorano Orchestrator.


    Figure 1: Adding SocketAdapter compoent to Fiorano Orchestrator
     
  3. Click the SocketAdapter component and do any of the following to rename the component from 'SocketAdapter' to 'SocketServer':
    1. Press F2, change the name and click OK.


      Figure 2: Renaming using Keyboard action 'F2'
       
    2. Go to Name property under General tab in Properties, change the name and press ENTER.


      Figure 3: Renaming using General Properties

    Change in name is to distinguish it from the Socket that will be configured for client.

  4. Double-click the SocketServer component in the Orchestrator to open Configuration Property Sheet (CPS).
  5. Click the Attributes tab and provide the following values:
    1. Select the Create Socket ? check box.
    2. Server IP: 127.0.01 (retain default IP)
    3. Port: 5436 (retain default port)
    4. Decoding Type: None
    This will start SocketServer on peer server machine at port 5436.


    Figure 4: SocketServer Configuration in CPS
     
  6. Click Finish to save the server configuration.

Socket Client Configuration

To configure SocketAdapter component for client, perform the following action in eStudio:

  1. Add a new Event Process with name 'SocketRW_Client_Eg'.
  2. Add SocketAdapter component to Fiorano Orchestrator and change the name to 'SocketClient' by following the steps mentioned in Socket Server Configuration section.
  3. Open SocketClient component CPS, click the Attributes tab, and provide the following values:
    1. Leave the Create Socket ? check box unchecked.
    2. Server IP: 127.0.01 (same IP as used in Server Configuration)
    3. Port: 5436 (same port as used in Server Configuration)
    4. Decoding Type: None


      Figure 5: SocketClient Configuration in CPS
       
  4. Click Finish to save the client configuration.

Composing Server Event Process

  1. In the SocketRW_Server_Eg Event Process Orchestrator, perform the following actions:
    1. Connect the SocketServer output port to the SocketServer input port


      Figure 6: Connecting SocketServer input port to output port
  2. Drag two Display components from Util category to the Orchestrator.


    Figure 7: Adding Display components to SocketRW_Server_Eg event process

Connect the Display components to the SocketServer and rename them to match the SocketServer output port names in following manner:

  1. Connect Display1 to SocketServer OUT_PORT and rename it to DisplayMessage.
  2. Connect Display2 to SocketServer STATUS_PORT and rename it to DisplayStatus.


    Figure 8: Connecting Display components to SocketServer

Composing Client Event Process

In the SocketRW_Client_Eg Event Process Orchestrator, perform the following actions:

  1. Drag one Feeder and one Display component from Micro Service Palette under Util category.
  2. Connect the components in the following manner:
    1. Feeder component output port to SocketClient input port.
    2. SocketClient output port to Display component input port.
       

    Figure 9: Adding Display components to SocketRW_Client_Eg event process
Understanding the Data Flow

Data flows in the following order:

  1. Feeder sends data to SocketClient.
  2. SocketServer receives the data from ServerClient and displays it in DisplayMessage.
  3. SocketServer redirects the data back to SocketClient and displays the successful write-back status in DisplayStatus.
  4. SocketClient receives the data back from server and displays it in Display1.


Figure 10: Data flow between SocketServer and SocketClient

Running the Example

Open SocketRW_Server_Eg Event Process Orchestrator and perfrom the following actions:

  1. Click Check Resource and Connectivity 
    icon (or press ALT+SHIFT+C) to check resource and connectivity.
  2. Click Run Event Process 
    icon (ALT+SHIFT+R) to run the event process. DisplayMessage and DisplayStatus windows get open.
  3. Switch to SocketRW_Client_Eg Event Process Orchestrator and follow steps 1 and 2 above. Feeder1 and Display1 components get open.
  4. In the Client Feeder1 window, replace 'Input Text' with 'TestMessage' and click Send.


    Figure 11: Sending message from Feeder
     
  5. DisplayMessage window displays the message from the client that is received by the server.


    Figure 12: Displaying Message received from client
     
  6. DisplayStatus shows the confirmation message 'Message Sent Successfully' as the server writes the message back to the client.


    Figure 13: Status message indicating that message is written back to client
     
  7. Display1 receives the message that is sent back from the server.


    Figure 14: Message sent back by Server, received by the client

Reference


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.