PDA

Click to See Complete Forum and Search --> : Winsock, connected??? Help!


gnaver
Jan 25th, 2006, 01:53 AM
I was wondering if you could help me on checking if the server is started or not.

so that I can make a offline/online function..

I have tried this:
Winsock1.Connect "192.168.46.12", "8866"
but don’t know what to do now, I don’t know if the connection is made or not.

How can I check that?

lerroux
Jan 25th, 2006, 02:01 AM
i dont remember how that works, although i have made that a while ago, anyways you can always search theses forums, there are always good answers here

ganeshmoorthy
Jan 25th, 2006, 02:02 AM
check for the other winsock control's ConnectionRequest event, if that is triggered accept it from that end. then your connection is on.

ganeshmoorthy
Jan 25th, 2006, 02:03 AM
yes, you can search for winsock in this forum. i remember somebody posted about this yesterday.

gnaver
Jan 25th, 2006, 02:20 AM
i have search, this forum, but cant seem to find anything about this.

i just need it to open a connection to a winsock server, check if it is online, if it is online then msgbox "Server is online!".

Something like that...

lerroux
Jan 25th, 2006, 02:27 AM
try searching planetsourcecode.... hope you find your answer...http://www.smileypad.com/v10/Cache/Feelings/Ask.gif

Hack
Jan 25th, 2006, 06:18 AM
Give this (http://www.mentalis.org/apilist/InternetGetConnectedState.shtml) API a try. :)

SAGremlin
Jan 25th, 2006, 08:43 AM
Use the UDPProtocol.. instead of TCP.. and send a small block of data to the server on any port..
Then all you need is a DataArrival sub on the Winsock.. If the Connection is accepted.. the Server will send a type of "What is this"reply.. or if the server is there but regects the connection.. you get a connection reset by Peer error that is trapable.. and usable to say well server is online...

hope this helps..

Gremmy..

Pino
Jan 25th, 2006, 09:35 AM
What is the server? Is it a program you have wrote or a game server etc?

bulletrick
Jan 25th, 2006, 10:03 AM
I was wondering if you could help me on checking if the server is started or not.

so that I can make a offline/online function..

I have tried this:
Winsock1.Connect "192.168.46.12", "8866"
but don’t know what to do now, I don’t know if the connection is made or not.

How can I check that?

Always use TCP. It's more reliable.

Why not try using the Winsock_Connect() sub-procedure? It will execute if the connection is succesful.

If the server is down, the Winsock_Error( ) sub-procedure will execute. Try to find out what is error number when there is no server then use


If number = serverDownErrorNum then
' write what should be done if the server is down
end if

gnaver
Jan 25th, 2006, 02:11 PM
thanks bulletrick your method works perfect.. ;)

bulletrick
Jan 26th, 2006, 01:12 AM
thanks bulletrick your method works perfect.. ;)

Your welcome.

Pino
Jan 26th, 2006, 05:54 AM
Please do not ask for reputation points its not allowed :)
Pino

bulletrick
Jan 26th, 2006, 06:28 PM
Please do not ask for reputation points its not allowed :)
Pino

Hehe. I was right. Actually, it wasn't my idea. :D Sorry. :afrog: