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

x
?
Solved

Network Programming

Posted on 1999-07-14
1
Medium Priority
?
193 Views
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.)
0
Comment
Question by:chunfei
[X]
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
 
LVL 3

Accepted Solution

by:
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("100.100.100.10",2045);
socket.Recieve(szBuffer,255);

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.

shay
0

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 (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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