Huntone
January 22nd, 2010, 08:43 AM
hello all, i have some problem, need to create a small form that will show server status.
Im working in Visual Studio 2010 C# language.
I have example of code but it's in VC++, i dont know how to rewrite it in VC#
this is VC++ code:
Dim tcpC As New TcpClient
Dim tcpC2 As New TcpClient
Try
tcpC.Connect(IPServer, 7777)
txtGameServer.Text = "OnLine"
txtGameServer.ForeColor = Color.Green
Catch a As Exception
txtGameServer.Text = "OffLine"
txtGameServer.ForeColor = Color.Red
End Try
tcpC.Close()
Try
tcpC2.Connect(IPServer, 2106)
txtLoginServer.Text = "OnLine"
txtLoginServer.ForeColor = Color.Green
Catch a As Exception
txtLoginServer.Text = "OffLine"
txtLoginServer.ForeColor = Color.Red
End Try
tcpC2.Close()
i need something similair for VC#
On form there is going to be something like this:
Server status: Online (or if tcp query comes in fault it says "Offline")
How can i do that, im really a newbie :) Plz help me
Im working in Visual Studio 2010 C# language.
I have example of code but it's in VC++, i dont know how to rewrite it in VC#
this is VC++ code:
Dim tcpC As New TcpClient
Dim tcpC2 As New TcpClient
Try
tcpC.Connect(IPServer, 7777)
txtGameServer.Text = "OnLine"
txtGameServer.ForeColor = Color.Green
Catch a As Exception
txtGameServer.Text = "OffLine"
txtGameServer.ForeColor = Color.Red
End Try
tcpC.Close()
Try
tcpC2.Connect(IPServer, 2106)
txtLoginServer.Text = "OnLine"
txtLoginServer.ForeColor = Color.Green
Catch a As Exception
txtLoginServer.Text = "OffLine"
txtLoginServer.ForeColor = Color.Red
End Try
tcpC2.Close()
i need something similair for VC#
On form there is going to be something like this:
Server status: Online (or if tcp query comes in fault it says "Offline")
How can i do that, im really a newbie :) Plz help me