Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
Old June 13th, 2009   #1 (permalink)
Registered User
 
Join Date: Jun 2009
Location: Indonesia
Posts: 2
How to bind more than one client in one computer to UDP winsock server with ms.acces

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
esugiawan is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old June 13th, 2009   #2 (permalink)
Hackin 'n Slashin
 
SCHUMI_4EVER's Avatar
 
Join Date: Jan 2007
Location: Corrupt Rapist run South Africa
Posts: 11,220
Please try and look for the correct forum for your question next time...don't just post it anywhere...
__________________
Intel Core2Quad Q9550 (2.83Ghz stock) | ASUS P5Q | 2x2GB Transcend JetRam DDR2-800 | ASUS ENGTX260\HDTP\896M | Windows Vista Home Premium 64bit SP1
The Champ has retired but may his Legacy live on FOREVER !!!!
Get it right fools! The glass is HALF-EMPTY, not half-full!!!
!!! WARNING: Emulation requires a brain !!! WARNING: Emulation =/= Piracy !!!

Last edited by SCHUMI_4EVER; June 13th, 2009 at 17:59.
SCHUMI_4EVER is offline   Reply With Quote
Old June 13th, 2009   #3 (permalink)
Knowledge is the solution
 
Proto's Avatar
 
Join Date: Dec 2002
Location: Milwaukee, US. Previously in Mexico City
Posts: 6,527
What I normally do with Unix sockets sockets is to fork a process for every client that comes and request a connection. That is, you use a main socket for listening for start session requests, but you fork a new, different socket to establish a formal connection with that client. That way you can keep the main socket open to listen for more incoming connections (This would be akin to some sort of socket factory).
__________________
Proto is online now   Reply With Quote
Old June 15th, 2009   #4 (permalink)
Registered User
 
Join Date: Jun 2009
Location: Indonesia
Posts: 2
@SCHUMI_4EVER , thx for your's warning and sorry for that
@proto , thx for reply, right now i don't know what are you mind, but i will try to search your answer in google and thx again for open my mind.
esugiawan is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 18:33.

© 2006 - 2008 Emu Forums | About Emu Forums | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5