| | |
ping to check connection
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Dec 2007
Posts: 7
Reputation:
Solved Threads: 0
Hi Guys
is there a way to incorparate the ping function into a app what i want to do is when the user trys to connect it opens a window and displays
1, pinging "ipaddress"
and if succesfull displays connecting to host ie "ipadress" from above
but if no ping return says connection failed
but i dont know how to do this could someone point me in the right direction please
TIA
is there a way to incorparate the ping function into a app what i want to do is when the user trys to connect it opens a window and displays
1, pinging "ipaddress"
and if succesfull displays connecting to host ie "ipadress" from above
but if no ping return says connection failed
but i dont know how to do this could someone point me in the right direction please
TIA
C++ Syntax (Toggle Plain Text)
std::cin >> ipadd; commandArg = "ping " + ipadd.c_str(); system(commandArg);
Something along those lines should do you nicely. c_str() is in the string header btw.
Chris
Knowledge is power -- But experience is everything
•
•
Join Date: Dec 2007
Posts: 7
Reputation:
Solved Threads: 0
Hi Freaky_Chris
thanks for the answer sir so after that runs i need to add a if and else statement on the result ?
what i plan on doing is have a ebox with the ipaddress and a button that says connect after that the window with pining ipaddress and if pinged a button ok becomes active if no ping then text saying connection failed.
also is there a better way of doing it?
TIA
thanks for the answer sir so after that runs i need to add a if and else statement on the result ?
what i plan on doing is have a ebox with the ipaddress and a button that says connect after that the window with pining ipaddress and if pinged a button ok becomes active if no ping then text saying connection failed.
also is there a better way of doing it?
TIA
You could redirect it to a text file, and then read the text file or examine pipes.
Then read the text file. thats the simpler option the better option would probably be pipes.
Chris
C++ Syntax (Toggle Plain Text)
system("ping anipaddress > %TEMP%textfile.txt")
Chris
Knowledge is power -- But experience is everything
![]() |
Similar Threads
- YAHOO DSL w/NETGEAR router wont give me connection (Networking Hardware Configuration)
- Internet Connected But Won't Open Web Pages (Viruses, Spyware and other Nasties)
- help for a novice (Networking Hardware Configuration)
- Nothing Works (Internet connection) Please Help (Networking Hardware Configuration)
- internet connection...... (Networking Hardware Configuration)
- SBC DSL - Internet Explorer connection problem (Web Browsers)
- Ready to throw router out the window (Networking Hardware Configuration)
- Wireless Connection Excellent but working intermitently (Networking Hardware Configuration)
- Internet connection troubles with Linksys Wireless Router (Networking Hardware Configuration)
- Internet connection randomly shutting down (Networking Hardware Configuration)
Other Threads in the C++ Forum
- Previous Thread: How do you export members to an exe from a custom DLL?
- Next Thread: files..and stuff..and comparing...and compiling..ohh
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy directshow dll download dynamic dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib library linkedlist linker list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings studio temperature template test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





)