fb:porticula NoPaste
vb-winsock
Uploader: | max06 |
Datum/Zeit: | 16.07.2007 11:34:35 |
Imports System
Imports System.Net
Imports System.IO
Imports VB = Microsoft.VisualBasic
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Winsock wird geschlosse
AxWinsock1.Close()
'Die IP des Servers
AxWinsock1.RemoteHost = "irc.freenode.org"
'Der Port des Servers
AxWinsock1.RemotePort = "6667"
'Verbinde Winsock !
AxWinsock1.Connect()
Button1.Enabled = False
Button2.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'Label1 gibt den Status wieder
'Label1.Text = AxWinsock1.State
Label1.Text = CStr(AxWinsock1.CtlState)
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
'MsgBox(AxWinsock1.StateConverter)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
AxWinsock1.Close()
Button1.Enabled = True
Button2.Enabled = False
End Sub
Private Sub AxWinsock1_DataArrival(ByVal sender As System.Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles AxWinsock1.DataArrival
Dim Result As String
'Die Variable result gibt die empfangenen Daten wieder;
'Entweder die variable Result muss als String dim. werden
'oder bei Winsock1.GetData Result muss hinten vbstring
'dazugeschrieben werden
AxWinsock1.GetData(Result)
Select Case VB.Left(Result, 4) 'Befehlsauswertung
End Select
TextBox1.Text = Result
Label2.Text = Result
End Sub
End Class