Windows socket programing

I am writing a client to receive packets from a server that a vendor wrote for an equipment.  For some reason I am not able to get anything back from the server.  I can send it stuff no problem, but I don't get a response back from it.

Client end provided by vendor:

int TCPClient::waitEvents(long millis) {
      timeval timeout;
      timeout.tv_sec = 0;
      timeout.tv_usec = millis*1000;
      fd_set      fd;
      FD_SET(socketHandle, &fd);
      sockaddr_in      from;
      int            len = sizeof(sockaddr_in);
                int         ret = 0;
      int num;
                int err=0;
      if ((num = select(NULL, &fd,NULL , NULL, &timeout)) > 0)  //<---right here I get a 0 returned by select and that's my problem.  In case of an error (socket error...etc) I should get a -1, but I get a zero.

"select" is defined by MS in winsock2.h as follows:

    int nfds,
    fd_set FAR * readfds,
    fd_set FAR * writefds,
    fd_set FAR *exceptfds,
    const struct timeval FAR * timeout

What could my problem be?  Please help me I'm lost.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

YOu need to set nfds
Mind you, it says at that you don't, because it is ignored. I hadn't readlised that.
You're not just timing out are you?
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

axnst2Author Commented:
What does nfds contain and what's a reasonable value for it?
axnst2Author Commented:
I might be..I am trying to communicate with it on a factory floor, wirless, 200 ft
axnst2Author Commented:
That was my guess too...I am setting up a laptop as we speek
I usually do something like this:

       timeout.tv_sec = millis/1000;
       timeout.tv_usec = (millis%1000)*1000;

I've not seen if the timeout works with the timeout entirely in the microsecs part.
nfds is conventionally the highest-numbered descriptor in any of the three descriptor sets plus 1; but the MS document says that it is being ignored.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
How long are you waiting?   i.e. what is millis?

also be sure you're not overflowing the integer arithmetic, or the size of usec.
A few simple if() statements as suspenders wouldnt hurt.

In my experience the debugging of these kinds of problems goes about a bazillion times faster if you have some sort of network sniffer.  Many times a peek at a packet immediately shows the problem, where otherwise I would have flailed around for weeks trying various things.

There are several nice free sniffers for Windows and Linux, I strongly  suggest you get one of these.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.