|
-
Jan 25th, 2006, 02:53 AM
#1
Thread Starter
Hyperactive Member
Winsock, connected??? Help!
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?
-
Jan 25th, 2006, 03:01 AM
#2
Fanatic Member
Re: Winsock, connected??? Help!
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
WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...
-
Jan 25th, 2006, 03:02 AM
#3
Re: Winsock, connected??? Help!
check for the other winsock control's ConnectionRequest event, if that is triggered accept it from that end. then your connection is on.
-
Jan 25th, 2006, 03:03 AM
#4
Re: Winsock, connected??? Help!
yes, you can search for winsock in this forum. i remember somebody posted about this yesterday.
-
Jan 25th, 2006, 03:20 AM
#5
Thread Starter
Hyperactive Member
Re: Winsock, connected??? Help!
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...
-
Jan 25th, 2006, 03:27 AM
#6
Fanatic Member
Re: Winsock, connected??? Help!
try searching planetsourcecode.... hope you find your answer...
WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...
-
Jan 25th, 2006, 07:18 AM
#7
Re: Winsock, connected??? Help!
Give this API a try.
-
Jan 25th, 2006, 09:43 AM
#8
Member
Re: Winsock, connected??? Help!
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..
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving & sizing Images , Animation 1 , 2 , 3 , User Controls
Projects & Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom, moving images : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Other Projects : Direct Physics - Inter Wise Proxy
Find me in VB6., VB.NET , Writing Articles, My Genealogy, wiccca Forum ____________________________________________
-
Jan 25th, 2006, 10:35 AM
#9
Re: Winsock, connected??? Help!
What is the server? Is it a program you have wrote or a game server etc?
-
Jan 25th, 2006, 11:03 AM
#10
Addicted Member
Re: Winsock, connected??? Help!
 Originally Posted by gnaver
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
VB Code:
If number = serverDownErrorNum then
' write what should be done if the server is down
end if
-
Jan 25th, 2006, 03:11 PM
#11
Thread Starter
Hyperactive Member
Re: Winsock, connected??? Help!
thanks bulletrick your method works perfect..
-
Jan 26th, 2006, 02:12 AM
#12
Addicted Member
Re: Winsock, connected??? Help!
 Originally Posted by gnaver
thanks bulletrick your method works perfect.. 
Your welcome.
Last edited by Pino; Jan 26th, 2006 at 06:53 AM.
-
Jan 26th, 2006, 06:54 AM
#13
Re: Winsock, connected??? Help!
Please do not ask for reputation points its not allowed 
Pino
-
Jan 26th, 2006, 07:28 PM
#14
Addicted Member
Re: Winsock, connected??? Help!
 Originally Posted by Pino
Please do not ask for reputation points its not allowed 
Pino
Hehe. I was right. Actually, it wasn't my idea. Sorry.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|