Results 1 to 14 of 14

Thread: Winsock, connected??? Help!

  1. #1

    Thread Starter
    Hyperactive Member gnaver's Avatar
    Join Date
    Jul 2005
    Location
    Denmark/Sweden
    Posts
    289

    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?

  2. #2
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    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...

  3. #3
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    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.

  4. #4
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Winsock, connected??? Help!

    yes, you can search for winsock in this forum. i remember somebody posted about this yesterday.

  5. #5

    Thread Starter
    Hyperactive Member gnaver's Avatar
    Join Date
    Jul 2005
    Location
    Denmark/Sweden
    Posts
    289

    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...

  6. #6
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    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...

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Winsock, connected??? Help!

    Give this API a try.

  8. #8
    Member SAGremlin's Avatar
    Join Date
    Jan 2006
    Location
    JHB South Africa...
    Posts
    58

    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..
    ____________________________________________

  9. #9
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Winsock, connected??? Help!

    What is the server? Is it a program you have wrote or a game server etc?

  10. #10
    Addicted Member bulletrick's Avatar
    Join Date
    Jul 2005
    Location
    Philippines
    Posts
    248

    Lightbulb Re: Winsock, connected??? Help!

    Quote 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:
    1. If number = serverDownErrorNum then
    2. ' write what should be done if the server is down
    3. end if

  11. #11

    Thread Starter
    Hyperactive Member gnaver's Avatar
    Join Date
    Jul 2005
    Location
    Denmark/Sweden
    Posts
    289

    Re: Winsock, connected??? Help!

    thanks bulletrick your method works perfect..

  12. #12
    Addicted Member bulletrick's Avatar
    Join Date
    Jul 2005
    Location
    Philippines
    Posts
    248

    Wink Re: Winsock, connected??? Help!

    Quote Originally Posted by gnaver
    thanks bulletrick your method works perfect..
    Your welcome.
    Last edited by Pino; Jan 26th, 2006 at 06:53 AM.

  13. #13
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Winsock, connected??? Help!

    Please do not ask for reputation points its not allowed
    Pino

  14. #14
    Addicted Member bulletrick's Avatar
    Join Date
    Jul 2005
    Location
    Philippines
    Posts
    248

    Talking Re: Winsock, connected??? Help!

    Quote 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
  •  



Click Here to Expand Forum to Full Width