Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C port programming

Status
Not open for further replies.

mccafferypaul

Programmer
Oct 21, 2003
3
0
0
GB
is it possible to set up a program that listens for outgoing data on ports being used by other software in C API. i am mainly a java programmer and not too sure about C.

Also are there features in C to allow writing to a port that has already been opened by other software or duplicate the packets it is sending?

Sort of like a proxy with extended functionality
 
> is it possible to set up a program that listens for outgoing data on ports being used by other software in C API
Yeah, you can use the libpcap library which is used by ethereal

> Also are there features in C to allow writing to a port that has already been opened by other software
Doubtful - but check what libpcap can do, but as far as I know it only monitors traffic.
It is somewhat easier to intercept the original connection and filter traffic that way (say for writing a spam trap front-end to your email client).

--
 
Yeah, I agree with the front end.

You can use PipeStreams in Java to communicate with processes so you could write a C program to handle the sockets (however, you have to mess with different socket codes unless libpcap handles independent of platform) and have the java program execute it. The Java program could then "talk" with the C program in sending and receiving information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top