?
Solved

VB 6 Client/server program with multiple clients connected to one server.

Posted on 2003-03-09
5
Medium Priority
?
261 Views
Last Modified: 2013-11-13
I Have created a program for a user that uses "WINSOCK" to connect the client program to the server. The problem is that the user demands to have several clients to connect to one server. How do I make this several or multiple clients to one server? Do I have to Use multiple winsock? if I do, then I would have to open multiple ports and it would slow down the server. What should I use to connect multiple clients to this one server? thankz!
0
Comment
Question by:Bcoloutlaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Expert Comment

by:viper123
ID: 8101189
Do a loop checking for the socket.
private sub winsock1_connectionrequest

If Index = 0 Then

'// your code here
'// first connection to client

else

'// multiple client
 
varEnviron.SockMax = varEnviron.SockMax + 1

ReDim Preserve arrSockAvi(varEnviron.SockMax)

Load wskSocket(varEnviron.SockMax)

wskSocket(varEnviron.SockMax).LocalPort = _ varEnviron.LocalPort

wskSocket(varEnviron.SockMax).Accept requestID

end if
end sub
0
 
LVL 4

Expert Comment

by:iozturk
ID: 8101798

First set your winsock control's index value to 0 then
check this example.

Private intMax As Long

Private Sub Form_Load()
   intMax = 0
   sckServer(0).LocalPort = 1001
   sckServer(0).Listen
End Sub

Private Sub sckServer_ConnectionRequest _
(Index As Integer, ByVal requestID As Long)
   If Index = 0 Then
      intMax = intMax + 1
      Load sckServer(intMax)
      sckServer(intMax).LocalPort = 0
      sckServer(intMax).Accept requestID
      Load txtData(intMax)
   End If
End Sub



0
 

Expert Comment

by:CleanupPing
ID: 8900422
Bcoloutlaw:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9074588
Bcoloutlaw, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Save as PAQ -- No Refund.

DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
YensidMod earned 0 total points
ID: 9165948
Question is PAQ'd and no points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question