You are here:

C++/Socket and Multithreading


sir i have a program for ping a computer in C.
i want to introduce multithreading so i can ping
every computer on network parallely. currently i am only able to ping every computer on network serialy. please provide some useful guidelines and if possible provide source code also.

         thanking you

Combination of socket programming and multi-threading is generally a bit confusing, as different OS and compilers behave differently. However your case is not that complicated as you don't need to have any listening socket, and just need a socket to connect to other machines.
You should basicly create a thread that can handle your ping request. There exist sample codes aroung and VC++ also has sample code in MSDN. Then in thread handle function, you should do the socket connection with the requested ping server. Angain there are many sample codes available, and you already have the code, yourself.


All Answers

Answers by Expert:

Ask Experts




You may ask me about simple to complicated C/C++ programming methods/style and most like questions about network programming in C++.


I'm a professional programer in C++ and network/internet programming.

©2016 All rights reserved.