5,693,062 members and growing! (18,249 online)
Email Password   helpLost your password?
General Programming » Internet / Network » General     Intermediate

Hello world application for socket programming in windows

By DharmeshC

Application for newbies in the world of
VC7.1, C++, Windows, .NET, .NET 1.1, MFC, VS.NET2003, Visual Studio, Dev

Posted: 20 Oct 2007
Updated: 20 Oct 2007
Views: 9,824
Bookmarked: 5 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
10 votes for this Article.
Popularity: 1.50 Rating: 1.50 out of 5
5 votes, 50.0%
1
1 vote, 10.0%
2
0 votes, 0.0%
3
2 votes, 20.0%
4
2 votes, 20.0%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Introduction

This snippest is for every one who are just newbie in the world of network / socket programming.

I do no find any ready-made resourses that describe socket programming in simplest level thats why i made this VC++ console based application to demo all of newbie.

Background

  • Newbie should have basic of C/C++ programming
  • MSVC++ environment as i made this code in MSVC++ 2003

Using the code

As you can see this overall application devide into two part client and server.

Generally server are in listening mode, accept connection and it can recv / send data from client.

Client just connect with server and send / recv data from there.

As Demo, i have made application in which client just connect with server and after server accept connection client send data to server and server recv that data and display on screen.

Also, no you can see in client i have used loop back IP address defined 127.0.0.1 means you can test directly thos client and server on single machine, If you want to test it in different machine than change it appropriately.

To test the application you need to run first Server exe after just run Client exe and enter some data by default i have take max length of data at time is 10 byte so enter up to 10 byte and just press enter you can see that data are recv on server screen.

Screenshot - demo.jpg

Points of Interest

You can enhance this application to make it two way means both can recv and send data,

also you can port this application to dialog based and can make you own chating tool,

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

DharmeshC



Occupation: Web Developer
Location: India India

Other popular Internet / Network articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 2 of 2 (Total in Forum: 2) (Refresh)FirstPrevNext
GeneralDon't upload build garbage!memberKevinSW23:52 2 Oct '08  
Generaltestmemberyctsai17:27 21 Oct '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 20 Oct 2007
Editor:
Copyright 2007 by DharmeshC
Everything else Copyright © CodeProject, 1999-2008
Web19 | Advertise on the Code Project