Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Classic Visual Basic (VB 6 or earlier) » COM/ActiveX » How to bind more than one client in one...


How to bind more than one client in one...Expand / Collapse
Author
Message
Posted 6/13/2009 5:32:42 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/18/2009 4:16:42 AM
Posts: 1, Visits: 2
How to bind more than one client in one computer to winsock server

i have 1 application server in server computer
and 5 client application  in one computer. ( install 5 client in one computer )
i use oswinsck winsock UDP protocol
if only 1 client connect to server, everything well done
but if more than one client connected to server , will be errror
"Method 'Bind' of object 'IMSWinsockControl' Failed


my question is how to solve this problem
application server and application client , i made with ms.access xp

-----------
server
-----------
Option Compare Database
Dim WithEvents WsServer As OSWINSCK.Winsock


Private Sub cmdSend_Click()
On Error GoTo salah
    WsServer.SendData txtUserIdJats
Exit Sub

salah:
    MsgRoes Err.Description, "Test Msg"
End Sub


Private Sub Form_Load()

 
   Set WsServer = CreateObject("OSWINSCK.Winsock")
   WsServer.Protocol = sckUDPProtocol
   WsServer.RemoteHost = ipserver
   WsServer.RemotePort = rport
  
End Sub


Private Sub WsServer_OnClose()
    WsServer.CloseWinsock
End Sub

Private Sub WsServer_OnDataArrival(ByVal bytesTotal As Long)
On Error GoTo salah

  Dim sBuffer As String
  WsServer.GetData sBuffer
   Me.List6.AddItem "Data : " & sBuffer & vbCrLf
  
Exit Sub

salah:
    MsgRoes Err.Description, "Winsock Data Arrival"
End Sub

Private Sub WsServer_OnError(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)
  MsgBox Description, vbOKOnly, "Winsock Error: " & Number
  CancelDisplay = True
End Sub

---------------------
Client
---------------------

Option Compare Database
Dim WithEvents wsClient As OSWINSCK.Winsock

Private Sub Command5_Click()
    wsClient.SendData Me.Text6
End Sub

Private Sub Form_Close()
    wsClient.CloseWinsock
End Sub


Private Sub Form_Load()

    Set wsClient = CreateObject("OSWINSCK.Winsock")
    wsClient.Protocol = sckUDPProtocol
    wsClient.Bind 51010
 
   
End Sub


Private Sub wsClient_OnDataArrival(ByVal bytesTotal As Long)
 
  Dim sBuffer As String
  wsClient.GetData sBuffer
  Me.List6.AddItem "Data : " & sBuffer & vbCrLf

End Sub


 

heelo

Post #27794
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 2:23am