Announcement

Collapse
No announcement yet.

TCP and Threads

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TCP and Threads

    I am officially going insane over this!

    I have downloaded every example I can find regarding implementing
    a TCP server. I was successful in applying Don Dickinson's rserver
    solution to my database program, however when I tried calling
    database functions in a loop (e.g. appending 100's of records) the
    server came to a standstill. A process that would take a second or
    two in standalone mode now took 20 or 30 seconds - ouch!

    I figure it is a bottleneck with the sending and receiving of
    TCP commands so I am trying to put each connection into its
    own thread. I have banged my head against the wall so many times
    that I can not focus any longer! Everytime the client connects
    it GPF's at the call to the create thread.

    Can some TCP client/server geniuses please share some code with
    me on a simple client/server implementation that uses threads
    for each connection????? Maybe I am just missing the boat with
    this. If I can get this bottleneck resolved then I am off to the
    races because my database DLL has already been modified to handle
    both standalone (client only) and multiuser (client/server).

    I have code available if anyone is willing to (or brave enough) to
    peek into my demented attempt at TCP multithreading


    Thanks,



    ------------------
    Paul Squires
    mailto:[email protected][email protected]</A>
    Paul Squires
    FireFly Visual Designer (for PowerBASIC Windows 10+)
    Version 3 now available.
    http://www.planetsquires.com

  • #2
    Take a look at Erik Olsen's code for an HTTP server. It uses multi-threading to handle tons of incoming clients.

    I've tested it with up to 5000 simultaneous connections.

    --Dave


    ------------------
    Home of the BASIC Gurus
    www.basicguru.com
    Home of the BASIC Gurus
    www.basicguru.com

    Comment


    • #3
      Thanks Dave, I'll try that. I looked at that a little bit before
      and I was trying to create a new thread when the %FD_ACCEPT
      message is called.

      I'll strip my code down to the bare bones and use Eric's as a
      model. Hopefully by tomorrow I'll get this working.

      Dave, do you think creating threads will solve the bottleneck
      I'm experiencing? I would hate to have to spend another day
      fighting with my code just to find out I'm no further ahead.

      Thanks,



      ------------------
      Paul Squires
      mailto:[email protected][email protected]</A>
      Paul Squires
      FireFly Visual Designer (for PowerBASIC Windows 10+)
      Version 3 now available.
      http://www.planetsquires.com

      Comment


      • #4
        Hi Paul,
        Go ahead and send over that code you mentioned in your email and I'll have a look. I've been unsuccessful in sending you emails (they keep getting rejected). Also, I have a multi-threaded database that I use for in-house only purposes. If I can get it cleaned up I'll send you the code - maybe it'll help.
        --Don

        ------------------
        dickinson.basicguru.com
        Don Dickinson
        www.greatwebdivide.com

        Comment

        Working...
        X