Koceljeva Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Koceljeva Forum


 
PrijemTražiLatest imagesRegistruj sePristupi

 

 [VB6] connector

Ići dole 
AutorPoruka
archer

archer


Muški Broj poruka : 297
Godina : 31
Lokacija : Kamenica
Datum upisa : 23.06.2007

[VB6] connector Empty
PočaljiNaslov: [VB6] connector   [VB6] connector Icon_minitimePet Sep 26, 2008 7:27 pm

Evo i mon projekta uradjenog u vb6 uz pomoc winsock kontrole:
Kod:

'coded by arch[3]r
Private Sub cmdCon_Click()
On Error Resume Next
sock.Protocol = sckTCPProtocol
sock.RemoteHost = txtIP.Text
sock.RemotePort = txtPort.Text
sock.Connect
cmdCon.Enabled = False
cmdD.Enabled = True
Command4.Enabled = False
End Sub

Private Sub cmdD_Click()
On Error Resume Next
sock.Close
cmdCon.Enabled = True
cmdD.Enabled = False
Command4.Enabled = True
End Sub

Private Sub Command1_Click()
On Error Resume Next
If sock.State = sckConnected Then
sock.SendData txtSend.Text
txtR.Text = txtR.Text & "You:" & vbCrLf & " " & txtSend.Text & vbCrLf
txtSend.Text = ""
Else
txtSend.Text = ""
MsgBox "Niste konektovani", vbInformation + vbOKOnly, "Connector:Error"
End If
If Err.Number <> 0 Then
MsgBox "Error!" & vbCrLf & "Dogodila se greska u toku izvrsavanja programa." & vbCrLf & "Podatak se nemoze poslati.", vbCritical + vbDefaultButton1 + vbOKCancel, "Connector:Error"
Err.Clear
End If
End Sub

Private Sub Command2_Click(Index As Integer)
txtR.Text = ""
End Sub

Private Sub Command3_Click()
End
End Sub


Private Sub Command4_Click()
On Error Resume Next
sock.LocalPort = txtPort.Text
sock.Listen
cmdCon.Enabled = False
Command4.Enabled = False
cmdD.Enabled = True
End Sub

Private Sub Form_Load()

End Sub

Private Sub res_Click(Index As Integer)
On Error Resume Next
sock.Close
Me.Hide
Call Shell(App.Path & "\" & App.EXEName & ".exe", vbNormalFocus)
If Err.Number <> 0 Then
MsgBox "Error!" & vbCrLf & "Dogodila se greska u toku izvrsavanja programa.", vbCritical + vbDefaultButton1 + vbOKCancel, "Connector:Error"
Err.Clear
End If
End
End Sub


Private Sub sock_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next

    Dim strData As String
    sock.GetData strData, vbString
    txtR.Text = txtR.Text & "Remote machin:" & vbCrLf & " " & strData & vbCrLf
   
If Err.Number <> 0 Then
MsgBox "Error!" & vbCrLf & "Dogodila se greska u toku izvrsavanja programa," & vbCrLf & "probajte da restartujete program.", vbCritical + vbDefaultButton1 + vbOKCancel, "Connector:Error"
Err.Clear
End If
End Sub

Private Sub Timer1_Timer()
txtLIP.Text = sock.LocalIP
If sock.State = sckConnected Then
lblS.Caption = "Connected"
End If

If sock.State = sckClosed Then
lblS.Caption = "Closed"
End If
If sock.State = sckOpen Then
lblS.Caption = "Open"
End If
If sock.State = sckListening Then
lblS.Caption = "Listening"
End If
If sock.State = sckConnectionPending Then
lblS.Caption = "Connection pending"
End If
If sock.State = sckResolvingHost Then
lblS.Caption = "Resolving host"
End If
If sock.State = sckHostResolved Then
lblS.Caption = "Host resolved"
End If
If sock.State = sckConnecting Then
lblS.Caption = "Connecting"
End If
If sock.State = sckClosing Then
lblS.Caption = "Closing"
End If
If sock.State = sckError Then
lblS.Caption = "Error"
End If
End Sub
Private Sub sock_ConnectionRequest(ByVal requestID As Long)
  If sock.State = sckListening Then
    sock.Close
    sock.Accept requestID
  End If
End Sub
Nazad na vrh Ići dole
archer

archer


Muški Broj poruka : 297
Godina : 31
Lokacija : Kamenica
Datum upisa : 23.06.2007

[VB6] connector Empty
PočaljiNaslov: Re: [VB6] connector   [VB6] connector Icon_minitimePet Sep 26, 2008 7:41 pm

Kod je neuredan, a ne bas koristan sam od sebe. Ako nekome treba ceo program neka mi se javi. Evo i jedan screenshot:
[VB6] connector C0nnec10
Nazad na vrh Ići dole
 
[VB6] connector
Nazad na vrh 
Strana 1 od 1

Dozvole ovog foruma:Ne možete odgovarati na teme u ovom forumu
Koceljeva Forum :: Hi-tech :: Vasi projekti-
Skoči na: