-
May 29th, 2004, 04:34 AM
#1
Network commands from c++
Does anyone know of a website that could help me learn how to do things like ping/tracert to an inputted ip adress in c++? Thanks,
Jared
It is better to die on your feet than to live on your knees.
-
May 29th, 2004, 04:40 AM
#2
Re: Network commands from c++
Originally posted here by Jareds411
Does anyone know of a website that could help me learn how to do things like ping/tracert to an inputted ip adress in c++? Thanks,
Jared
Hey Hey,
As you were having problems compiling a c++ application, it would lead me to wonder just how much c++ knowledge you have. I would suggest first learning the basics of the language before you get into more indepth network programming. www.cplusplus.com is always a decent resource. http://www.tutorialized.com/tutorial...p/Networking/1 has some really decent network programming tutorials.
Search google, there's a plenthora of information out there. A tutorial that was great for one person may not be a style that you can learn from.
Peace,
HT
-
May 29th, 2004, 04:42 AM
#3
First if you don't already know basic socket progamming look at this one:
http://www.ecst.csuchico.edu/~beej/guide/net/html/
Creating ping and tracert programs would be very difficult. I suggest you just stick with the ping and tracert commands built in to Linux and Windows.
If you really want to see some source code on it, go to www.pscode.com and search for it on there.
mjk
-
May 29th, 2004, 04:44 AM
#4
Why do I always get beaten?
-
May 29th, 2004, 04:54 AM
#5
Originally posted here by mjk
Creating ping and tracert programs would be very difficult. I suggest you just stick with the ping and tracert commands built in to Linux and Windows.
mjk
I don't want to make a new ping or tracert, I just want to be able to, say, make a program that would ask for an ip adress and then ping it.
It is better to die on your feet than to live on your knees.
-
May 29th, 2004, 05:05 AM
#6
Hey Hey,
If that's all your looking for do a search for Python Intro or Intro Python here on AO. I've written several tutorials on Python and one of them includes calling ping through python... I think that's what you mean. It's written in python, not c++, but python is so much better IMHO, other than the fact that it's interpretted... but the code is almost always cross-platform compliant... a lot more often thatn c/c++ anyways. However in c++ it wouldn't be much harder.... there's a system() function that you can call.
Code:
variable = user input
system("command %variable", variable)
or something similar to that.....
Peace,
HT
-
May 29th, 2004, 05:12 AM
#7
Hi Jareds411,
If you aren't yet at the Intermediate C++ programmer stage, I would advise putting a network programming project in C++ off until you have become a more accomplished C++ hacker. If your goal is simply to write some network programs, and or learn about network programming, I would suggest doing it in Perl. Even if you don't know Perl right at this moment, the time it will take you to learn what you need to know and get some socket programming under you belt will be much shorter than the same endeavour in either C or C++. Besides, your Perl code is likely to have less bugs and run faster than a similar program written by a novice C or C++ programmer.
If Perl sounds like a good jumping off point for this project, I'd recommend heading over to http://www.perl.org/ and scoping out the vast resources on the subject for a place to start. Be sure and check out http://www.cpan.org as well, lot's of good Perl modules related to network tasks.
Hope that helps.
-- spurious
I don't know much about Python except that so many people say it's wonderful to learn to program with.... Definitely take HTRegz's suggestion and give Python a look.
Get OpenSolaris http://www.opensolaris.org/
-
May 29th, 2004, 05:13 AM
#8
Yep, Python rules. Here's what I was able to come up with.
Code:
import os
ip = raw_input("Enter IP address to be pinged: ")
os.system("ping %s" % ip)
I would have written an example in C++ for you but unfortunately I'm not familiar with string manipulation.
mjk
-
May 29th, 2004, 05:23 AM
#9
I agree with spurious that Perl would also be a better route to take. If you insist on continuing with c++ I'd recommend picking up stroustrups book, a book on the stl, and a good guide for programming on whatever os it is you prefer at the very least.
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
-
May 29th, 2004, 12:39 PM
#10
Banned
well u didn't mention about the OS u r using anyway i think u should try this book
http://www.amazon.com/exec/obidos/tg...74552?v=glance
and there is also a book for network programming in c++ C++ Network Programming, Volume 2: Systematic Reuse with ACE and Frameworks
by Douglas C. Schmidt and as always google is ur best friend to if u r looking for a specific command for ping then there no library function in c++ to do that
affcourse u can make ur own for that
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|