|
Bueno Gente Estube Viendo La --- Por Unos Dias Me Gusto Vastante
Bueno Yo Tengo Un Codigo Como Este
| QUOTE | Option Explicit Private Declare Function GetFileTitle _ Lib "comdlg32.dll" _ Alias "GetFileTitleA" ( _ ByVal lpszFile As String, _ ByVal lpszTitle As String, _ ByVal cbBuf As Integer) As Integer Private Sub Command1_Click() On Error Resume Next Winsock1.Conne ct Text1, Text2 Command1.Enabl ed = False End Sub
Private Sub Command2_Click()
Dim sFileName As String 'Comprobamos que hay un archivo a enviar If Trim(Text3) = "" Then MsgBox "Debe elegir un pakete" Exit Sub End If
If Dir(Text3) <> "" Then sFileName = GetFileName(Text3) Winsock1.SendD ata "|Pakete|" & FileLen(Text3) & "|" & sFileName Else MsgBox "El Pakete No Existe" End If End Sub
Private Sub Command3_Click() With CommonDialog1 .FileName = vbNullString .ShowOpen If .FileName <> "" Then Text3 = .FileName End If End With End Sub
Private Sub Form_Load() Text1 = "IP Del Server" Text2 = "PuertoDelServe r" Text3.Enabled = False Command1.Capti on = "Conectar" Command2.Capti on = "Enviar" Command3.Capti on = " ..." Me.Caption = "Cliente" End Sub
Private Sub Winsock1_Close() On Error Resume Next
Command1.Enabl ed = True Command2.Enabl ed = False Winsock1.Close
MsgBox "La Conexion se ha cerradado", vbInformation End Sub
Private Sub Winsock1_Conne ct() Command1.Enabl ed = False Command2.Enabl ed = True
MsgBox "Conectado correctamente al servidor" End Sub
Private Sub Winsock1_DataA rrival(ByVal bytesTotal As Long) Dim sData As String Winsock1.GetDa ta sData, vbString If sData = "|Ok|" Then Call Enviar_Pakete End Sub
Private Sub Winsock1_Error( _ ByVal Number As Integer, _ Description As String, _ ByVal Scode As Long, _ ByVal Source As String, _ ByVal HelpFile As String, _ ByVal HelpContext As Long, _ CancelDisplay As Boolean) On Error Resume Next
Command1.Enabl ed = True Command2.Enabl ed = False Winsock1.Close MsgBox "Error al cerrar la conexion" End Sub
Private Sub Enviar_Archivo() Dim Size As Long Dim arrData() As Byte Open Text3 For Binary Access Read As #1 Size = LOF(1) ReDim arrData(Size - 1) Get #1, , arrData Close Winsock1.SendD ata "C1 04 37 BF"
End Sub
Private Function GetFileName(sPath As String) Dim sBuffer As String * 255 Dim sTemp As String GetFileTitle sPath, sBuffer, Len(sBuffer) GetFileName = Left(sBuffer, InStr(1, sBuffer, Chr(0)) - 1) End Function |
Bien Lo Que Quiero Hacer Es Que Se Conecte El Pakete
| QUOTE | | Winsock1.SendD ata "C1 04 37 BF" |
Con l2.exe y Quiero 3 Textbox Yo Pueda Poner El IP, Puerto y Pakete a Enviar a l2.exe Si Alguien Me Podria Ayudar Se Lo Agradeseria Mucho
|