C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 09-11-2005, 11:47 AM   #1
Registered User
 
Join Date: Sep 2005
Posts: 9
establish a connection using TCP and capture the incoming packets

hello ..

i have to write a program in C++,to establish a TCP connection to internet and then sniff the packets using UDP..study those packets in details..i mean demarcate the packets...

the OS on which i work is windows 98,and i work with Turbo C compiler.

so,how do i start off with such kind of programming??

th
shraddha is offline   Reply With Quote
Old 09-11-2005, 11:50 AM   #2
Super Moderator
 
Join Date: Sep 2001
Posts: 4,746
I recommend Beej's Guide to Network Programming

http://www.ecst.csuchico.edu/~beej/guide/net/

I also recommend a newer compiler - like the freely available and hugely popular Dev-C++ from Bloodshed.
sean is offline   Reply With Quote
Old 09-11-2005, 12:49 PM   #3
Registered User
 
Join Date: Apr 2005
Posts: 134
Since you are planning to develop this program on Windows Platform you need to Learn Winsock programming. Also, you definitely need little advanced compiler (and preferebly an advanced OS ). Anyway just check out the link below. It will give you a good heads-up.

Winsock Programmer's FAQ
nkhambal is offline   Reply With Quote
Old 09-12-2005, 07:41 AM   #4
Registered User
 
Join Date: Sep 2005
Posts: 9
thank you for links u send me..it really helped.

but for now ,i m looking forward to write a simple code in C or C++ ,just to extract the data
coming in while i m online,as the byte stream...as in i have written a simple C program,using inportb() and outportb(),but it does not work.could u suggest me some better way of doing it,but in C or C++ only
shraddha is offline   Reply With Quote
Old 09-12-2005, 10:51 AM   #5
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
It's not going to happen with that fossil compiler.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 09-13-2005, 05:51 AM   #6
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
Is this your dial-up connection to your ISP via a modem on a COM port?
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 09-13-2005, 06:08 AM   #7
Registered User
 
Join Date: Sep 2005
Posts: 9
yes!! its a dial up connection
shraddha is offline   Reply With Quote
Old 09-13-2005, 10:58 AM   #8
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
Well if you're in windows, then I think the only way you'll get to sniff the COM port is by
a) Using some tools
http://www.softpedia.com/get/Network...-Monitor.shtml
http://www.sysinternals.com/Utilities/Portmon.html
b) Writing some win32 hook functions (no I don't know how to do this).

Also, since you're actually trying to interpret an IP link, perhaps ethereal will do it for you as well. Note I don't know this will work since I've only ever used ethereal on proper networks.
http://www.ethereal.com/

None of this stands a chance of working with your crusty old compiler.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 09-13-2005, 12:51 PM   #9
Registered User
 
Join Date: Sep 2004
Location: California
Posts: 3,020
Quote:
Also, since you're actually trying to interpret an IP link, perhaps ethereal will do it for you as well.
I don't believe ethereal works on dialup or ISDN connections.

shraddha, I think you need to do a better job explaining exactly what it is you are trying to accomplish. I'm still not sure whether you are trying to sniff packets from a connection, or simply create your own connection to some server.
bithub is offline   Reply With Quote
Old 09-14-2005, 08:55 AM   #10
Registered User
 
Join Date: Sep 2005
Posts: 9
i m just trying to sniff packets from a connection..
shraddha is offline   Reply With Quote
Old 09-14-2005, 03:21 PM   #11
* Death to Visual Basic *
 
Devil Panther's Avatar
 
Join Date: Aug 2001
Posts: 768
Quote:
Originally Posted by shraddha
... establish a TCP connection to internet and then sniff the packets using UDP...
please explain what do you mean by sniffing using UDP???
__________________
"I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

http://www.Bloodware.net - Developing free software for the community.
Devil Panther is offline   Reply With Quote
Old 09-27-2005, 07:48 AM   #12
Arron
 
Join Date: Jul 2005
Posts: 17
"establish a TCP connection to internet and then sniff the packets using UDP"

You wan't a TCP session with internet. That's clear
What's the next one ? Sniff the packets using UDP ??
Once u establish a connection (TCP), how will it accept UDP pacets for you to sniff ?
arron is offline   Reply With Quote
Old 10-22-2005, 02:15 AM   #13
tin
Registered User
 
Join Date: Sep 2004
Posts: 12
Sniffing

When you sniff for packets, you get all kinds TCP, UDP, ICMP and others. Perhaps you want to capture the TCP packets that you're sending. You can use ethereal for that if you don't want to write code.

If you do want to write C code for packet capture, take a look at the Pcap library. It makes life a lot easier for network sniffing.
tin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 12:05 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22