12 replies
by megafabinfo Accepted solution
by tony hopkinson Accepted solution
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 ?
by megafabinfo Accepted solution
by dutchgemini Accepted solution
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
by megafabinfo Accepted solution
by briandao Accepted solution
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.
by megafabinfo Accepted solution
by tony hopkinson Accepted solution
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.
type = "?">
...
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.
by megafabinfo Accepted solution
by xwindowsjunkie Accepted solution
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.
by megafabinfo Accepted solution
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
by xwindowsjunkie Accepted solution
You might have the client setup to receive a set of variable values from the server that become the begin and end of the recordset. Use a timer object to trigger the client to form a new recordset query and transmit it to the server where I presume the database is hosted. This transmitted query will use the recordset begin and end values received previously from the server. If the server has a new end point larger in value then the one it receives from the client, it modifies the recordset query and sends the data set back with the new begin and end points.
If the client is going to be modifying the database, that will require a different sort or type of SQL query dependent somewhat on the type of database. I can't help you there simply because I'm not a SQL guru.
In the database itself, (Assuming its a MS SQL or Access database) I suggest that you let the database host application always use ascending ID numbers as the primary key. Use a second number as a sort number for the record.
When you mentioned flex-grid did you mean MSHFlexGrid? If not you might look at it. Its a VB6 Professional component.
To connect to the database, the client application will most likely need to use the Microsoft ADO Data Control. Use the ADOdc to point to and connect to the database and the FlexGrid component will be your data display component. Change the SQL text in the ADOdc to send the query to the host.
All versions of VB6 have the Timer component. I seem to remember that you could only have 10 instances of the timer object in any given application. Adding multiple timers though makes things a little rough to keep tract of. It makes a lot more sense to use one timer and have it run at such rate that all timer related functions can run off of it at different intervals held internal to the subroutine.
Any more than that I can't give you since it seems as if the project might be of the scope or size that I would charge my customer for it.
Hope this helps. I still suggest that you do the code at least for the client in VB2005dotNet. You can download "Express" editions of VB2005 and try it out for free.
This discussion is closed to new replies.
Trending Networks posts
Sort by Trending