EldoS | Feel safer!

Software components for data protection, secure storage and transfer

How do I use ELSocket for incomming connections

Posted: 03/14/2016 12:45:19
by Steve Hardt (Standard support level)
Joined: 09/01/2013
Posts: 1

I am trying to build a simple telnet command server and was trying to use the ELSocket to listen for incoming connections but I do not see anywhere on how to do this. I can use it for outgoing with no issues. Are there some examples that I can look at or tell me how to do this properly.

Also on the IPV6 if the ELClient is listening, will it allow connections from both IPV4 and IPV6?
Posted: 03/14/2016 13:45:16
by Ken Ivanov (Team)

Hi Steve,

TElSocket is an internal component, so we don't provide any specific documentation for it. Of course, you can use it if it fits your requirements, but please be aware that we reserve the right to change its behaviour/interface in future without notice (yet we are really unlikely to).

A server-side TElSocket is supposed to be used in the following way:


    // Opening a listening socket

    Socket.ListenAddress := Address;
    Socket.ListenPort := Port;
    Socket.UseIPv6 := UseIPv6;
      if Socket.Bind <> 0 then
        raise EElSSHForwardingError.Create(SFailedToBindServerSocket);
      if Socket.Listen <> 0 then
        raise EElSSHForwardingError.Create(SFailedToBindServerSocket);
      if Port = 0 then
        BoundPort := Socket.BoundPort
        BoundPort := Port;
      // failed to set up a listening socket

    // accept loop (it is a good idea to run it in a separate thread)
    while not Terminated do
      AccSocket := nil;
      Socket.Accept(2000, AccSocket);
      if AccSocket <> nil then
        // Connection accepted, use AccSocket to send and receive data
        // (you might wish to do that from a separate thread)
        // When you are finished with this connection, close the socket
        // with AccSocket.Close()

    // when you are finished with listening,
    // close the listening socket with Socket.Close()

Also on the IPV6 if the ELClient is listening, will it allow connections from both IPV4 and IPV6?

If the provided ListenAddress supports IPv4, then yes, the socket will be able to accept both IPv6 and IPv4 connections.

Hope this helps.




Topic viewed 2062 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!