Hola que tal. Gracias por ingresar. Les comento mi problema. Yo tengo hecho un programa, que todo va bien pero cuando lo pruebo en otra pc salta el error del Winsock. Busque en internet y vi que tenia que usar el CsocketMaster, lo configuro todo tal cual es pero ahora no me conecta ni en modo de ejecucion. Quisiera saber si alguien me puede ayudar a poder hacerlo andar bien.
Codigo Cliente:
Private Sub Command1_Click()
On Error GoTo ssig:
With Winsock1:
.Close
.RemotePort = Val(Text2.Text)
.RemoteHost = Text1.Text
.Connect
End With
If Winsock1.State <> 7 Then
Caption = "Desconectado"
Else
Caption = "Conectado"
Exit Sub
ssig:
MsgBox Err.Description, vbCritical + vbOKOnly, Err.Source
Err.Clear
End If
End Sub
Private Sub Command3_Click()
Text3.Text = Text3.Text & vbCrLf & "-->" & Text4.Text
Winsock1.SendData "Cliente --> " & Text4.Text
End Sub
Private Sub Form_Load()
Form2.Hide
Command3.Enabled = False
End Sub
Private Sub PaneldeControl_Click()
Form2.Show
End Sub
Private Sub Salir_Click()
End
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command3_Click
End Sub
Private Sub Winsock1_Close()
Caption = "Desconectado"
Command3.Enabled = False
End Sub
Private Sub Winsock1_connect()
Caption = "Conectado"
Command3.Enabled = True
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim datos As String
Winsock1.GetData datos, vbString
Text3 = Text3 & vbCrLf & datos
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)
Caption = "Error"
Err.Clear
End Sub
Codigo Servidor:
Option Explicit
Dim WithEvents Winsock1 As CSocketMaster
Private Sub Command1_Click()
Text1.Text = Text1.Text & vbCrLf & "-->" & Text2.Text
Winsock1.SendData "Servidor --> " & Text2.Text
End Sub
Private Sub Form_Load()
Set Winsock1 = New CSocketMaster
With Winsock1
.CloseSck
.LocalPort = 4576
.Listen
End With
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1_Click
End Sub
Private Sub Winsock1_CloseSck()
Caption = "Desconectado"
End Sub
Private Sub Winsock1_Connect()
Caption = "Conectado"
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.CloseSck
Winsock1.Accept requestID
If Winsock1.State <> 7 Then: Caption = "Desconectado": Else: Caption = "Conectado"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim datos As String
Winsock1.GetData datos, vbString
Text1 = Text1 & vbCrLf & datos
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)
Caption = "Error"
End Sub
Private Sub Text1_Change(): Text1.SelStart = Len(Text1.Text): End Sub
Muchas Gracias por atender mi problema
Que tengan un buen dia!
pues simplemente tenes que copiar ese ocx en la maquina donde te salta el error.
Copiarlo y registrarlo! :D
Abrir símbolo de sistema como administrador y...
regsvr32 "C:\Windows\System32\MiOCXejemplo.ocx"
Ok muchas Gracias a los dos por responder. Voy a probarlo
Saludos
EDITO
Al final anduvo con lo que me dijeron..
Gracias a los dos!
Saludos