tailieunhanh - Socket Programming in C# ­ Part 1 – Introduction

The purpose of this article is to show you how you can do socket programming in C#. This article assumes some familiarity with the socket programming, though you need not to be expert in socket programming. There are several flavors to socket programming ­ like client side , server side , blocking or synchronous , non­blocking or asynchronous etc. With all these flavors in mind , I have decided to break this subject into two parts. In the part 1 I will start with the client side blocking socket. Later on in the second part I will show you how to create server side and non­blocking. . | Network programming in windows is possible with sockets. A socket is like a handle to a file. Socket programming resembles the file IO as does the Serial Communication. You can use sockets programming to have two applications communicate with each other. The application are typically on the different computers but they can be on same computer. For the two applications to talk to each either on the same or different computers using sockets one application is generally a server that keeps listening to the incoming requests and the other application acts as a client and makes the connection to the server application. The server application can either accept or reject the connection. If the server accepts the connection, a dialog can begin with between the client and the server. Once the client is done with whatever it needs to do it can close the connection with the server. Connections are expensive in the sense that servers allow finite connections to occur. During the time client has an active connection it can send the data to the server and/or receive the data.

TỪ KHÓA LIÊN QUAN