Blake81
Well-known member
Hi,
I'm trying to make an admin console/bot for my own IRC server, but I can't figure out how to get this to connect to my server. I need to connect to my local IP address (192.168.1.97). I tried some other things, but I couldn't figure out how to convert that IP to a long IP. I found that the TCPClient class can use the hostname as an argument, so I'm trying to use the hostname of my computer (Dorothy). Could someone please look at this and tell me what's wrong? It finally loads the form without errors, but I'm not so sure it's connecting. I'll also need help with how to send commands to the server once I figure this out. Thanks. Here's the code
You can ignore all the commented lines. I was just testing some things.
I'm trying to make an admin console/bot for my own IRC server, but I can't figure out how to get this to connect to my server. I need to connect to my local IP address (192.168.1.97). I tried some other things, but I couldn't figure out how to convert that IP to a long IP. I found that the TCPClient class can use the hostname as an argument, so I'm trying to use the hostname of my computer (Dorothy). Could someone please look at this and tell me what's wrong? It finally loads the form without errors, but I'm not so sure it's connecting. I'll also need help with how to send commands to the server once I figure this out. Thanks. Here's the code
VB.NET:
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form1_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2].Load
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Client [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] System.Net.Sockets.TcpClient()
Client.Connect([/SIZE][SIZE=2][COLOR=#800000]"Dorothy"[/COLOR][/SIZE][SIZE=2], 6667)
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Stream [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Net.Sockets.NetworkStream = Client.GetStream
Sock_Connect()
[/SIZE][SIZE=2][COLOR=#008000]'Stream.Write("NICK " & "VB_Bot" & vbCrLf)
[/COLOR][/SIZE][SIZE=2]Client.GetStream()
[/SIZE][SIZE=2][COLOR=#008000]'Client.Send("NICK " & "VB_Bot" & vbCrLf)
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'Client.Send("USER " & "VB_Bot" & " " & "Dorothy" & " " & _
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'UCase("Dorothy" & ":" & 1903 & "/0") & " :" & "VB_Bot" & vbCrLf)
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Sock_Connect()
MessageBox.Show([/SIZE][SIZE=2][COLOR=#800000]"Connected"[/COLOR][/SIZE][SIZE=2])
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE]