saludso bueno en mi aplicacion Cliente server quiero hacer esto:
desde el cliente voy a enviar un mensaje desde un textbox al server! de esta forma:
CLIENTE
Private Sub Command1_Click()
Dim var As String
If Text1.Text = "" Then
MsgBox ("Agrege un mensaje"), vbInformation, "Remote MSN Controler"
End If
var = Text1.Text
ws.SendData var
Text1.Text = ""
End Sub
Private Sub Command11_Click()
Form4.Show
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
Command2.Enabled = False
Command3.Enabled = True
Label1.Caption = "Estado con Server: Desconectado"
ws.Close
End Sub
Private Sub Command3_Click()
Timer1.Enabled = True
Command3.Enabled = False
Command2.Enabled = True
Timer1.Enabled = True
Label1.Caption = "Estado con Server: Escuchando..."
ws.LocalPort = 1234
ws.Listen
End Sub
Private Sub Command4_Click()
List1.Clear
ws.SendData "ref"
End Sub
Private Sub Command7_Click()
Form3.Show
End Sub
Private Sub Command9_Click()
Form2.Show
End Sub
Private Sub Form_Load()
Timer1.Interval = 5000
Timer1.Enabled = False
Command2.Enabled = False
If App.PrevInstance = True Then
End
End If
End Sub
Private Sub Label3_Click()
End
End Sub
Private Sub Label8_Click()
Me.WindowState = 1
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
If ws.State = 7 Then
Label1.Caption = "Estado con Server: Conectado..."
End If
If Not ws.State = 7 Then
Label1.Caption = "Estado con server: Descon./Escuchando.."
ws.LocalPort = 1234
ws.Listen
End If
DoEvents
If ws.State = 2 Then
Label1.Caption = "Estado con server: Escuchando..."
End If
If ws.State = 0 Then
Label1.Caption = "Estado con server: Desconectado"
ws.Connect "127.0.0.1", 1234
End If
DoEvents
End Sub
Private Sub ws_ConnectionRequest(ByVal requestID As Long)
ws.Close
ws.Accept requestID
End Sub
Private Sub ws_DataArrival(ByVal bytesTotal As Long)
Dim dato() As String
Dim datos As String
ws.GetData datos
If datos = "cont" Then
dato = Split(cont, "|")
For i = 1 To UBound(dato)
List1.AddItem dato(i)
Next
End If
End Sub
ahora envio eso que es el la variable texto con el texto luego:
SERVER
Public WithEvents MSN As Messenger
Public WithEvents MSNN As MessengerAPI.Messenger
Private Sub Form_Load()
Timer1.Interval = 60000
Set MSN = New Messenger
Set MSNN = New MessengerAPI.Messenger
ws.Connect "127.0.0.1", 1234
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If ws.State = 7 Then
GoTo fin
End If
If ws.State = 2 Then
GoTo fin
End If
If Not ws.State = 7 Then
ws.Close
ws.Connect "127.0.0.1", 1234
End If
fin:
End Sub
Private Sub ws_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim user As IMessengerContact
Dim venta As IMessengerConversationWnd
Dim datos As String
Dim cont As String
ws.GetData datos
If datos = "ref" Then
For Each user In MSNN.MyContacts
If user.Status = MISTATUS_ONLINE Or user.Status = BE_RIGHT_BACK Then
cont = cont & user.SigninName & "|"
End If
Next
End If
ws.SendData cont
If datos = Var Then
For Each user In MSNN.MyContacts
If user.Status = MISTATUS_ONLINE Or user.Status = MISTATUS_AWAY Or user.Status = MISTATUS_BE_RIGHT_BACK Then
Set venta = MSN.InstantMessage(user.SigninName)
SendKeys Var
SendKeys "{ENTER}"
venta.Close
DoEvents
End If
Next
End If
Set venta = Nothing
End Sub
pero este code no me sirve, osea no pasa nada como lo puedo arreglar?:S