Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Trouble with socket selector[Solved]  (Read 2166 times)

0 Members and 1 Guest are viewing this topic.

Azaral

  • Full Member
  • ***
  • Posts: 110
    • View Profile
Trouble with socket selector[Solved]
« on: January 14, 2014, 01:42:27 am »
So I'm trying to learn how to use the network package by making a simple chat program. The issue I'm having is using the socket selector. I followed the example given exactly, with some added cout's to see whats going on inside of it in the console. The issue I'm having is the server will act as expected, it gets to the if( selector.wait() ) part and the function blocks like it is suppose to. I know this because I have a text output right before that line and it is inside an infinite loop. However, once the first client connects to the server, the selector.wait() function fails to block. I know this because the server console window gets spammed with my message. It also never receives anything from the clients because I have an output on the server such that no matter what happens inside the if something will get pasted to the console screen.

There must be something I'm missing. I can't find it.

I'm running the test by connecting to local host if that matters.

Any help would be greatly appreciated.
« Last Edit: January 14, 2014, 05:37:07 pm by Azaral »

Azaral

  • Full Member
  • ***
  • Posts: 110
    • View Profile
Re: Trouble with socket selector
« Reply #1 on: January 14, 2014, 05:36:42 pm »
Solved this problem. Apparently I was losing the actual connection and fixed that.

 

anything