in reply to Tk & Socket: Tk::Error: fileno not same for read X and write Y

The overall design is not quite right. I cannot see the reason why Tk is involved here, at least base what you presented.

Now under this design, your program only accepts connections when fileevent is fired, which I believe is not what you want, as most likely the client comes any time it wishes. This shall really be a simple socket server side program without Tk.

When your program reaches that line accept socket connection, it just hangs until a client comes, this is not what should happen to a GUI application. This makes the person sitting before the computer really frustrated (at least when I was trying to play with your code).

Multi-threading might help you (one the other hand, most likely you would need multi-thread any way, or other similar technologies, for a socket server that expects multiple clients at a single given time), but still better reconsider whether Tk is needed.

  • Comment on Re: Tk & Socket: Tk::Error: fileno not same for read X and write Y

Replies are listed 'Best First'.
Re2: Tk & Socket: Tk::Error: fileno not same for read X and write Y
by bbfu (Curate) on Oct 15, 2003 at 02:37 UTC

    I cannot see the reason why Tk is involved here, at least base what you presented.

    I assume that the posted code is just a reduced test-case that shows the problem, and that the OP wanted to use a GUI to present the information obtained from the clients in some way or another. Tk would seem a reasonable choice under those circumstances.

    Of course, I agree that Tk should probably be left out of handling the sockets (see my other post), if that's what you meant.

    bbfu
    Black flowers blossom
    Fearless on my breath