Thread: sockets: trouble with getting client input

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    54

    sockets: trouble with getting client input

    I'm writing a toy MUD/chat server to learn more about socket programming and C++, but I'm having trouble with getting client input.

    I can start the server and then connect to it with telnet, but only the first message I send to the server is ever read and output; I don't know why.

    This function loops in a while(1) after all the initialization is done, and is supposed to handle new clients connecting as well as client input.

    http://pastebin.com/XmYLAKRy

    Client:
    telnet localhost 6000
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    stuff
    and more stuff
    some more stuff
    Server output:
    Player connecting.
    Adding player on fd 4.
    Player input: stuff
    Last edited by Boxknife; 04-17-2010 at 07:17 PM.

  2. #2
    Registered User
    Join Date
    Jun 2008
    Posts
    54
    I sort of figured out what's going on. Blocking for the player write and player exception fd_sets was stopping the program at select().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can someone help me with these errors please code included
    By geekrockergal in forum C Programming
    Replies: 7
    Last Post: 02-10-2009, 02:20 PM
  2. Trouble with error checking on input from user.
    By NuNn in forum C Programming
    Replies: 8
    Last Post: 01-23-2009, 12:59 PM
  3. trouble reading input
    By panfilero in forum C Programming
    Replies: 3
    Last Post: 11-21-2005, 06:18 PM
  4. Client and Server Sockets
    By Unregistered in forum C++ Programming
    Replies: 0
    Last Post: 01-09-2002, 09:53 AM
  5. Trouble with receiving input
    By BellosX in forum C Programming
    Replies: 4
    Last Post: 09-20-2001, 11:58 PM