DelphiFAQ Home Search:

Client / Server programming - generic steps to start a server or a client

 

comments17 comments. Current rating: 4 stars (5 votes). Leave comments and/ or rate it.

Client/server network programming requires a server running on one machine to listen and answer requests and one or more clients running either on the same machine or different machines connected to the server through a network.

Independent from your operating system and programming language, you'll have to follow the following basic steps to create and run a server (the function refers to the unix naming convention; almost all languages have interfaces to them):

  1. Create a socket with socket
  2. Bind the socket to a port address with bind
  3. Listen to the socket at the port address with listen
  4. Accept client connections with accept

Creating a client involves less steps:
  1. Create a socket with socket
  2. Connect the socket to the remote machine with connect


Most modern environments offer classes, components, beans, Active-X controls.. libraries.. to abstract this process but it's good to know the basic steps that happen behind the scenes in case you get an error message 'Cannot bind socket'.. 'port already in use'.


Content-type: text/html

Comments:

You are on page 2 of 2, other pages: 1 [2]
2013-07-10, 09:53:02
raffaele mosca from Italy  
rating
Raffaele Moscow to be robbed and poisoned
2015-02-01, 02:27:51
anonymous from Brazil  
Wonderful exnotpaailn of facts available here.
You are on page 2 of 2, other pages: 1 [2]

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: