Jump to content

Search the Community

Showing results for tags 'tsocket'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start




Found 1 result

  1. Hi, I have a Tcp daemon thread using TSocket from System.Net.Socket (cross platform), listening for incoming TCP connection and creating client threads when clients connect. It works just fine when compiled and run under Windows. I can connect with a Windows TCP client, a Linux TCP client, or even a simple Linux telnet session, and handle the client communication in the client thread. When compiled and run under Linux, it seems that TSocket.Accept always returns nil, even when a connection is successfully established via telnet or other client. Hence the code that creates the client threads is never executed.... In Linux, my logs show an infinite series of 'Daemon - Socket.Accept with timeout 500ms' followed by 'Daemon - No new connection after 500ms timeout', although a connection can be successfully established. However, without a client thread and a reference to the client socket, there isn't much I can do to handle the client communication... Has anyone seen this behavior when compiling a TCP server for Linux based on System.Net.Socket ? Any hint or help would be very much appreciated. procedure TTcpDaemon.Execute; var LConnectionSocket: TSocket; LConnectionThread: TTcpConnectionThread; begin FServerSocket := TSocket.Create(TSocketType.TCP, TEncoding.UTF8); FServerSocket.Listen(FIP, '', FPort); Log('Dameon started (IP: ' + FIP + ' Port: ' + IntToStr(FPort) + ')'); Log('Daemon - ConnectionThreadCount: ' + IntToStr(GetConnectionThreadCount)); while not Terminated do begin try Log('Daemon - Socket.Accept with timeout 500ms'); LConnectionSocket := FServerSocket.Accept(500); if Assigned(LConnectionSocket) then begin Log('Daemon - New connection - ' + LConnectionSocket.RemoteAddress + ':' + IntToStr(LConnectionSocket.RemotePort)); LConnectionThread := TTcpConnectionThread.Create(LConnectionSocket); FThreadList.Add(LConnectionThread); Log('Daemon - Adding new connection thread - ConnectionThreadCount: ' + IntToStr(GetConnectionThreadCount)); Log('Daemon - Starting new connection thread'); LConnectionThread.Start; end else Log('Daemon - No new connection after 500ms timeout'); except on E: Exception do Log(Self.ClassName + ' Exception (' + E.ClassName + '): ' + E.Message); end; end; TerminateAllThreads; FServerSocket.Close(True); end;