Hi, do someone knows a solution with this seldom bug?

when i get connected successfully the the programm wants to revieve something, but the whole consloeprogram get frezed. on a specify port the socket seems to be fucked.
I have XP and on Port 7 or 8 it get frezed.:mad:

Deep Regard FF
Posted on 2003-05-24 08:17:12 by Forginforcer
Post your code so people can help you.

BTW, port 7/tcp is reserved. That could cause some problems aswell.
Posted on 2003-05-24 20:49:09 by bazik
Why are you trying to use port 7 or 8? they are reserved! Ports 0 - 1023 are the well known ports and are assigned by the IANA and are to be used by the sytem.

Port 7 is the echo port and port 8 is reserved.... what are you trying to do? If you need a port, use a port above 1023!
Posted on 2003-05-25 00:01:14 by Gunner
I want to make a simple portscanner.

Wanted to make portscanner, as I wrote.
Posted on 2003-05-25 00:17:27 by Forginforcer
Your app is PROBABLY freezing for one of three reasons - you are using blocking calls, you are calling api that dont return until they complete, or you are generating so many WM's that the message queue is flooding.
Here's the easy way to "unfreeze" your program.
Create a "worker thread" for the networking stuff - and in the thread, make it wait on an event object before its allowed to do anything - or suspend it.
Now when you start the thread, it will work alongside the main app and not make it choke up and stop !!! The difference is that you can't use WM_SOCKET messages because the thread hasn't got a window to send them to - you use a "network event object" - like WSAWaitForSingleEvent or WSAWaitForMultipleEvents - winsock will send the FD's to a data structure that u have to check to see what KIND of network event you received.
Then you deal with it (all inside the thread) then jump back to the start of the thread, to the network event wait call.
If the app is a server, you should use WM to RECV new clients, then call CreateThread and pass it the socket handle to the new client returned from recv call.
If the app is a multisocket client, you should call "socket" form inside the worker thread, and create N threads from the main app.
For my first experience with the latter, I used WSAWaitForMultipleEvents which in hindsight was probably not a good choice.
Note that some of these functions are only available in winsock version 2+.

Don't believe something because m$ said it or because it was on the internet in black and white. Test things for yourself.

You can bind to ports below 1024 - these are "reserved" ports for the os - but you can bind to them if they aren't in use (how else could you write a webserver on port 80?)
Furthermore, if they are already in use, theres a generic exploit for MANY os and some windows that if a port which is already used is listening to INADDR_ANY ( that you call still bind ANOTHER SOCKET to it with the SO_REUSE flag. You can listen,send or hijack local servers using this.
It's been used in a couple of commercial socket monitor apps.
Posted on 2003-05-26 05:53:59 by Homer

Wanted to make portscanner, as I wrote.

did you? anyway, does it freeze if you're trying to connect to another computer, or just to localhost?
Posted on 2003-05-28 22:52:56 by jademtech
my local.
Posted on 2003-05-29 00:16:30 by Forginforcer
how to switch from blocking mode to nonblocking-mode?
Posted on 2003-05-29 11:14:17 by Forginforcer
Posted on 2003-06-13 23:45:03 by Homer