![]() |
| | #1 |
| Used Registerer Join Date: Feb 2002
Posts: 1,065
| Dumb question time - Winsock & accept() I'm building the server app and everything works fine until it gets to the accept() call. At that point, it just hangs. There is no client trying to connect. So, I'm guessing the hanging is because of that. Because I've been through Johnnie's Winsock tutorial and a couple others, and the problem is replicated in all of their code AND mine, I'm thinking it's because it's getting stuck looking for a client, but none is there. Sorry if this is elementary. I'm an admitted complete Winsock idiot. Jason |
| jdinger is offline | |
| | #2 |
| Registered User Join Date: Nov 2001
Posts: 1,348
| There are several solutions on the Win32 platform. One solution is a worker thread. Another solutions is AcceptEx(). Kuphryn |
| kuphryn is offline | |
| | #3 |
| Registered User Join Date: Jan 2002 Location: Cardiff
Posts: 2,219
| accept() waits until there is a client so it would hang. Use asynchronous sockets or threads if you want to do something else while it is waiting. |
| Brian is offline | |
| | #4 |
| Registered User Join Date: Dec 2003
Posts: 164
| You could use select() and put the waiting socket in an fd_set
__________________ Open source isn't a matter of life or death...... .......its much more important than that!! SuSE Linux - GCC 3.4.2 XP Pro - Visual Studio 2005 TS, MinGW 3.4.2 |
| eth0 is offline | |
| | #5 |
| Used Registerer Join Date: Feb 2002
Posts: 1,065
| Thanks, guys. I'm going to hit up MSDN tonight and study up on the suggestions you've made. Jason |
| jdinger is offline | |
| | #6 |
| #include<xErath.h> Join Date: Jun 2004
Posts: 724
| you could create a client program to connect to the localhost in a common port. |
| xErath is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sorry for a dumb question. | Vanished | C++ Programming | 7 | 11-23-2002 12:39 PM |
| winsock question | the Wookie | C++ Programming | 12 | 10-17-2002 02:18 AM |
| dumb question... | Sebastiani | A Brief History of Cprogramming.com | 3 | 07-28-2002 10:35 AM |
| time function question | heat511 | C++ Programming | 5 | 01-03-2002 02:23 PM |
| time class | Unregistered | C++ Programming | 1 | 12-11-2001 10:12 PM |