Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Network Programming

Posted on 1999-07-14
Medium Priority
Last Modified: 2010-04-02
I am currently working on a project that requires me to read input from TCP/IP ports using Visual C++ 6.0.  I would need to input the specific port number along with the IP address that I want to monitor.  The program will in turn monitor the port and output the data to the screen.

Since I do not have any network programming experience I am looking for all the help I can get. (Also, I do not know what library to use for this project. WinInet doesn't seem to be the right one.)
Question by:chunfei
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

Shay050799 earned 150 total points
ID: 1200118
Dear chunfei!
what u need to use is sockets, vc++ has 2 classes for that CSocket, and CAsyncSocket, the different between them is CAsyncSocket is blocked in recieve, untill something getting in the port.

to create new socket you have to hand it the IP address u want to connect to, and the port u want to connect through
like this CSocket socket(IP,Port)

now u have a connection established.

to send through that socket use the Send function with the buffer and its size, and to recieve use Recieve, with the buffer u want to get the info into and the size u expecting to get.

like this:

char szBuffer[255];
CSocket socket("",2045);

recieve returns the exect amount of bytes recieved, u can expect 255 bytes, but you actully can get only 100 or less or more...

hope that will help.


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

671 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