View Single Post
  #2 (permalink)  
Old 06-20-2008, 09:05 AM
MeTh0Dz MeTh0Dz is offline
SLICE OWNZ YOUR SOUL
 
Join Date: May 2008
Posts: 294
Last Blog:
Ternary Operator CPP
Credits: 0
Rep Power: 0
MeTh0Dz has a spectacular aura aboutMeTh0Dz has a spectacular aura aboutMeTh0Dz has a spectacular aura about
Default Re: Problem with the server software

First of all you are using <iostream.h>, which is a deprecated header. You just need to use <iostream>.

Next, you can't use 'cout' without 'using namespace std;', because 'cout' is in the std namespace. That is unless you do this 'std::cout', at every instance of 'cout'.

There is also no reason to 'return -1' in your main function, it doesn't matter what you return because you are in the main function and it is going to exit your program regardless.

The way you were doing WSAStartup was not working for me, and I looked at it for a while and it looked alright, so I just thought I'd show you this alternative method which I know works for sure.

Code:
int ret;
    WSAData wsadata;
    WORD ver = MAKEWORD(2, 0);
    ret = WSAStartup(ver,&wsadata);
    if (thing !=0) 
       {cout<<"winsock startup  failed\n"<<WSAGetLastError();
       getch();
       WSACleanup();
       return -1;
       }
Do that stuff and then tell me how it works.
Reply With Quote