|
|
|||||||
| Register | Links | Tutorials | Data Center | Blogs | Gallery | FAQ | Members List | Social Groups | Calendar | Search | Today's Posts | Mark Forums Read |
| Home | Submit Tutorial | What's New | What's Popular | Search |
| Reading and Writing TCP Sockets in C# |
|
|
|||||||
|
|||||||
| Difficulty: | Beginner | ||||||
| Estimated Time: | 15 mins | ||||||
| Skills Required: | Beginning C# programming | ||||||
| Tools Required: | Microsoft C# compiler (Express is fine) Untested on Mono, but should work. |
||||||
|
The Setup:
This VERY simple stand-alone console app will listen on a free port and echo one line sent from a client to the console, then wait for a newline to exit. Not production code, just the cheapest easiest way I know of to open a listening TCP socket and grabbing some data sent by the client. Let's start a new session. Launch MS C# of your favorite flavor. Select File -> New Project, Select Console Application from the Installed Templates, give it a name (like ConsoleTCPServer) and paste the following code into it:
(Page 1 of 5)
__________________
I Void Warranties™ CCTV Camera Systems and Security Camera Accessories by eMS. Ignore the CCTV Camera linkage. Just taking advantage of an inbound link opportunity... |
|||||||
| Tags: | None | ||||||