Solved

C# - Questions about developing a client/server application

Posted on 2014-01-10
5
296 Views
Last Modified: 2014-02-08
Hello,
I have developed a barcoding application in c# as a means of learning c# and .NET. Whilst the application utilises a SQL database on a remote server - it is not a client server application and as such requires a lot of needless setup on each individual PC which would not be required if it had been developed as a client/server system. I am now looking at re-developing this as a client/server application. All of the background processing will be done on the server and the screen inputs will be processed by the client. That being said - I know little or nothing about client server. I have some basic questions, such as:

- Which side should push/pull and how should communications between client/server work
- Should the client & Server be developed as two seperate projects

I obviously need to get the foundations right , so If someone can point me in the right direction and also point me to where I can find some non complex examples of client/server structure - I'd realy appreciate it.

regards
Pat
0
Comment
Question by:pclarke7
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 39771338
Yes, it would be two separate projects.  There are many variations but the simplest is that the client initiates all communications and the server only responds, never initiates.

So there is a service running on the server that is available at all times. The user interface on the client sends a request and the server responds. That is it! Each time the client wants to query or update, it sends a request and the server responds.  

Here is an example of writing a simple .net service:

http://blogs.msdn.com/b/bclteam/archive/2005/03/15/396428.aspx
0
 

Author Comment

by:pclarke7
ID: 39807512
Thanks MajorBigDeal,
just before I accept and close this can I ask if I develop the server part of my client/server application as a service - how difficult would it be to convert this to a web based service down the line. Would it be a complete re-write or a simple conversion ?

regards
Pat
0
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 39807600
That's a great question.  I'm a little swamped right now, if you don't mind waiting I'd like to try to answer your question next week.   I've only written a few web services but I've written many servers (both services and daemons) so I'm not a super-expert but I do feel entitled to an opinion.
0
 
LVL 11

Accepted Solution

by:
MajorBigDeal earned 500 total points
ID: 39826954
First, thanks for your patience.  Since it seems that you want to create this as a service before you later make it work as a web service, I think there are several different approaches that might work for you.   The first thing I want to do is get some terminology out of the way, please forgive me if this is repetitive for you.  Also, I'm defining these terms the way I use (and think) about them, which might be different from the way someone else thinks about it.

To me, a service is a process that runs outside a user context.  In other words, it runs all the time (generally speaking) and does not require that a user be connected to the machine. This is different from running Excel (for example), if you log out of your account your Excel spreadsheet has to terminate (I know you knew this already).

A web server is a service that primarily uses HTML to interact with the client's browser. IOW, it generally serves pages. Many web pages are useful applications and if someone wants to automate the use of the pages, they will often write code that mimics the way a human would use the the application in that it scans information on the page, fills in textboxes, clicks buttons, and so on.  This is a very cumbersome way for two computers to interact and it is also brittle (easily broken).

So we use web services instead. A web service generally doesn't use HTML, it uses a format designed to facilitate communication between applications rather than between an application and a human. The format I have used in the past is SOAP but I have heard that there are many others.

So lets assume that you have already written a service for use in your bar-coding application and it listens on port 49876 (for example) and uses a message format called ASN.1 which is very compact and binary in nature (very different from XML). So how are we going to make this into a web service using HTTP(S) and SOAP?  There are many approaches, some of which are:

1. Leave the current service intact, and write a brand-new web service that calls the existing service on the backend to avoid having to recode (or port) the working and debugged service.  IOW, the web service acts as a front-end to the older service. This provides an easy transition path (if you need that) because your users can continue using the older service while you test and tweak the new web service. It does have the big drawback of having to maintain two services that use very different techniques.
 
2. Modify the current service to to make it into a web-service in addition to its current functionality. There is no reason it can't do both.  This avoids having to maintain two services and still allows for an easier transition in that all your users would not all have to convert at the same time. It also allows one set of backend logic to support two different front-ends for the same service, which is more work but could have the beneficial side-effect of improving and clarifying your logic.  

3. Create a brand new web-service and tear down the older service. Copy and paste as much of the application functionality logic from the first service as practicable but other than that, it would be a complete rewrite.  

So after all that, you have probably figured out that the answer to your question: "Rewrite or Conversion?", is not clear-cut.  It depends a lot on what is important to you and what feels right to you.  If it were me, and I did not need a slow transition, and without knowing the details of your situation, I would choose option 3.  I would create a brand-new web-service application, and tear down the older service because I don't want to do double maintenance and have double complexity.    

That said, if you have not written this yet, why not just do it in a web service in the first place? Bite the bullet now to get into the technology you really want rather than double-handling it with two completely different approaches.
0
 

Author Closing Comment

by:pclarke7
ID: 39844538
Thanks MajorBigDeal,
for the effort that you went to , to answer my question. Excellent advice which I will try to adhere to.

regards
Pat
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now