[VB.NET] Checking Online Availability with IP and Port

  • Hello Guest! Welcome to ConsoleCrunch, to help support our site check out the premium upgrades HERE! to get exclusive access to our hidden content.
  • Unable to load portions of the website...
    If you use an ad blocker addon, you should disable it because it interferes with several elements of the site and blocks more than just adverts.
  • Read Rules Before Posting Post Virus Scans with every program.

1UP

Member
Oct 9, 2014
24
10
63
A while back I was making a launcher for a game server I was working on. And in order for the launcher to launch the game it had to go out and check to see if the servers were even online to begin with. Well I'll show you how I did that here:

We'll start with the imports
Code:
Imports System.Net.Sockets

Now for the variables
Code:
Dim logonServer As New TcpClient()

Code:
Try
  logonServer.Connect("168.144.77.91", 2106)
   
  Catch generatedExceptionName As Exception
  Me.pict_logonServer.BackColor = Color.Red

  End Try
  If logonServer.Connected Then

  Me.pict_logonServer.BackColor = Color.Green
  logonServer.Close()
  End If

This was using a Try catch so if it couldn't make the connection it would drop to Catch then execute whatever is after, in this case it turns the picturebox to red indicating the that server is not running.

If the program was able to connect successfully to the server then for the if statement, it would make the picturebox color Green then close the active connection.

If you plan to put this in form load like I did, I suggest putting it into it's own thread, that way the form launch won't hang as it trys to make the connection.

aionlaunch.jpg
 
  • Like
Reactions: Irving

Lindows

Super Moderator
Staff member
Moderator
Community Elite
Community Veteran
Determined Poster
Active Member
Console ID Poster
May 26, 2014
1,526
1,633
418
A while back I was making a launcher for a game server I was working on. And in order for the launcher to launch the game it had to go out and check to see if the servers were even online to begin with. Well I'll show you how I did that here:

We'll start with the imports
Code:
Imports System.Net.Sockets

Now for the variables
Code:
Dim logonServer As New TcpClient()

Code:
Try
  logonServer.Connect("168.144.77.91", 2106)
  
  Catch generatedExceptionName As Exception
  Me.pict_logonServer.BackColor = Color.Red

  End Try
  If logonServer.Connected Then

  Me.pict_logonServer.BackColor = Color.Green
  logonServer.Close()
  End If

This was using a Try catch so if it couldn't make the connection it would drop to Catch then execute whatever is after, in this case it turns the picturebox to red indicating the that server is not running.

If the program was able to connect successfully to the server then for the if statement, it would make the picturebox color Green then close the active connection.

If you plan to put this in form load like I did, I suggest putting it into it's own thread, that way the form launch won't hang as it trys to make the connection.

aionlaunch.jpg
Thanks for supporting the community ;)
 
General chit-chat
Help Users
  • @ EMRR:
    Can you help me?
  • @ QM|T_JinX:
    het bro nice work man
  • @ QM|T_JinX:
    with ?
  • @ EMRR:
    What do you mean? I can't understand "with ?"
  • @ QM|T_JinX:
    you ask can you help me and i said with what can i help you out
  • @ EMRR:
    Can you help me about share my generated CID's? Where can i share it on this website?
  • @ QM|T_JinX:
    you can put it in cid section or ps3 section in general
  • @ EMRR:
    Ok, thanks :)
  • @ QM|T_JinX:
    np bro
  • Chat Bot:
    EMRR has started a new thread called "Working Console ID" in Console ID's.
  • Chat Bot:
    EMRR has started a new thread called "Console ID 1" in Console ID's.
  • Chat Bot:
    wadu is our newest member. Welcome!
  • Chat Bot:
    EMRR has started a new thread called "Console ID 2" in Console ID's.
  • Chat Bot:
    QM|T_JinX has posted a new reply in the thread "Console ID 2".
  • @ lurch6661:
    gold hen out soon
  • Chat Bot:
    Christo has joined the room.
  • @ lurch6661:
    zap
  • @ lurch6661:
    trying to figure out how to run a rpf files
  • @ lurch6661:
    on gta5
  • @ lurch6661:
    i guess there is a way were you can upload real cars \
  • @ QM|T_JinX:
    rpf is a update like / update.rpf
  • @ lurch6661:
    also i cant find dmz
  • @ lurch6661:
    is that not warzone
    @ lurch6661: is that not warzone