Question

Locked

vbasic 6 Multi-Clients, Server Application

By megafabinfo ·
Please assist me in designing a clients/server app. in vbasic 6, although, i know how to design it by using TCP winsock, but my question is...let say 3 clients will be using a server-side program on seperate machine to connect to database, insert/select from database. request an id from database through winsock, use it to generate sponsorid for new member, after performing some calculation, send the data to winsock for further processing, and insertion into database. this database grows in number, how will i make the effect to occur at clients side datagrid concurrently. See is a big problem, but if u can just tell me how to make the architectural work of this project, give me samples that send multiple request, and get back multiple responsem or data throught recordset.

This conversation is currently closed to new comments.

12 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Depends on what you mean by concurrently.

by Tony Hopkinson In reply to vbasic 6 Multi-Clients, S ...

Do you mean you want any connected client to see that a new sponsor has been created as it happens whether they or an other user did it ?

Probably the simplest way to do that is to write a service.
Add a request to register with the server
have it connect to the DB
put your 'business logic' in methods/messages on this service and call them. When they result in a notifiable change trigger a message to all connected clients which then causes them to update the grid.

Why on earth are you still developing in VB6 ?

Collapse -

Vbasic 6 Multi-Clients, Server Application

by megafabinfo In reply to Depends on what you mean ...

thanks for your reply tony. forget about the concurrency, but wat i simply want is..how to design(and organise) 4 clients to send requests to the server and get responses. they do use the same database, but i don't want conflict to happen when each client is requesting. please better answer will be appreciated.

Collapse -

Out-of-process server

by dutch_gemini In reply to vbasic 6 Multi-Clients, S ...

Typical example for an out-of-process server COM implementation.

What you should do is to create a COM component that installs on a server and create in your VB6 code a reference to this object on the client.

More here: http://msdn2.microsoft.com/en-us/library/ms683835.aspx

Collapse -

vbasic 6 Multi-Clients, Server Application

by megafabinfo In reply to Out-of-process server

thanks dutch_gemini, see i know about com component in vbasic, how to use it on both client and server, using ip and port to connect each other, but my question is, in the case of multiple clients that access the same database in the server-side, am i going to use different port and winsock for them to connect to server since different services can be requested for

Collapse -

multi clients

by briandao In reply to vbasic 6 Multi-Clients, S ...

You don't have to have your server listen on a separate port for each client unless you wanted to. The server can listen on a designated port. As a connection request come in, it accept and hand off so it can continue to listen on the designated port.

You might want to goole for some "multi chat" project.

Collapse -

clients-server application

by megafabinfo In reply to multi clients

Am very greatful for this answer. if possible that i can use one port for all my clients connecting to the server. can i use a conditional statement in server to tell which client is connecting, does he want to insert to database ro select from database. please i will be very greatful if answer and samples is given to avoid conflict in my clients-server application

Collapse -

You get the client to send it's identifier

by Tony Hopkinson In reply to clients-server applicatio ...

the nice way to do it is to register with the server app and get it to give you a session id. You can add user logon to this if you want, use windows integrated security..., all sorts of good stuff.

A guid is nice. From then on while the client is running it uses it. If either end stops, you go round again with a new guid.

If the server is saving these sessionid's get it to bin them on restart and perhaps even from an admin request. It it was out on the internet you might want to kill them after x amount of inactivity as well and may be tie them to the IP /MAC info for security purposes.

It's robust, simple and you can improve it with reasonable ease.

For message traffic you need to define content.
Personally I'd use XML, it's a bit verbose, but you can set things up so you can add more functionality without breaking the crap out of everything.

<MESSAGE> type = "?">
<FROM CLIENT = "GUID">
<TO CLIENT = "GUID">
<CONTENT>... </CONTENT>
</MESSAGE>

is a start.
With a scheme like this you could even use UDP, as long as it's not too chatty.


You decode content based on type.
If you log undecodable messages as opposed to crashing, you can test out code at either end and see if it got there without killing your system and implement asynchronously. Put a feature in one end before the other)

Another nice trick is to add a test structure for comms problems.

And my favourite, if yu want to 'test' with live data and conditions.
Give your new version of an old message a different type. Run up the new client program and give it a good battering.

Database conflicts is a different animal, if you do all the database stuff in the server though, you can serialise the requests.

For instance you have a request to get a new X which is identified with a prinary key identity value, automatic number goes up by one (usually).
You send a message to the server program, and your mate does. The server processes one request then the other, no chance of them being given each other's X identifier.

Personally I'd start by queueing all requests and process them one by one.
Then I'd look at which ones (by type), I could safely process concurrently and run them on the spot instead of queueing them.

HtHs

PS You might want to think about asynchronous as well.
ie when you make a request don't block until you get a response. Slightly more complicated to code but much more robust and far easier to test and debug.

Collapse -

clients-server vb application

by megafabinfo In reply to multi clients

Am very greatful for this answer. if possible that i can use one port for all my clients connecting to the server. can i use a conditional statement in server to tell which client is connecting, does he want to insert to database ro select from database. please i will be very greatful if answer and samples is given to avoid conflict in my clients-server application

Collapse -

Coming late to this discussion but....

by Xwindowsjunkie In reply to vbasic 6 Multi-Clients, S ...

I've run into a situation with client server application written by a VB6 programmer at my company and its caused lots of problems. The winsock component in VB6, even the one in Service Pack 6, has a serious compatibility problem with Windows Server 2003 and it turns out with XP Pro SP2.

Megafabinfo I would seriously consider upgrading to VB .NET. Even VS2005 Standard edition is less than $150. If this job you're working on is going to require that you spend time supporting it, it makes sense to upgrade.

the dotNet VB controls have got the client/server function pretty well fixed. Also the data components to update a DB connection will take care of your "concurrency" issue. Updates and refresh functions can be scheduled in the control.

It seems that your application is still in design stage, If I were you I'd upgrade my toolset first.

Dealing with VB6 in an XP Pro system is bad enough, in a Vista environment, it will be difficult to keep it working because of the user permissions issues. I design XP Pro systems and VB6 is on the edge of breaking every time I have to change a file permission or a registry access permission.

If you insist on using VB6, for your own sanity, set your registry accesses up so that everything gets saved in HK_Current_User. For file permissions, set everything up so it reads and writes files in folders outside of Windows and Program Files. Also make sure that your user has permission to read and write into the database AND the file or folder share the DB will have to be sitting in. Then test your application with a Limited User logon. If it runs without error on all functions then you've made the grade, you're a pro VB6 programmer.

The reason I suggest dotNet VB is because I've used it and a lot of what you have to program into VB6 come automatically with the dotNet components. secure database connections are pre-programmed into the component at design time. It will make your project a lot easier to design and program.

From my screen name you'd surmise that I don't like Windows, yes that's true but the programming tools in VS2005 are excellent and worth the cost.

Collapse -

vbasic 6 Multi-Clients, Server Application

by megafabinfo In reply to Coming late to this discu ...

thanks for these advice Xwindowsjunkle.
But ui don't think i can move to vb.net now,because i have already designed a complete vb application (this multi-level marketing software). so my client want to start using 3 system with 1 server (where database will reside.)

please, tell me how to set my registry accesses up so that everything gets saved in HK_Current_User

Back to Networks Forum
12 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums