   socket problem (winsock)
  Hi all.im using visual c++ 6.0, trying to make a server in MFC using winsock.i do this :// start winsock2 (basic inits) & (error finding)void startupServerForListening(unsigned short port){// error time loggingtheTime = CTime::GetCurrentTime();CString d = theTime.Format( "%H:%M:%S : " );WSAData wsaData;if (WSAStartup(MAKEWORD(2, 2), &wsaData) == SOCKET_ERROR) {m_errorData.AddString(d +"Could not start up winsock");UpdateData(TRUE);errorlog("ERROR : Could not start up winsock");return;}int mySocket = socket(AF_INET, SOCK_STREAM, 0);// make sure nothing bad happenedif (mySocket == SOCKET_ERROR) {m_errorData.AddString(d +"Could opening socket");UpdateData(TRUE);errorlog("ERROR : Could opening socket");return;}// the address structurestruct sockaddr_in server;memset( &server, 0, sizeof server );// fill the address structure with appropriate dataserver.sin_family = AF_INET;server.sin_port = htons(port);server.sin_addr.s_addr = INADDR_ANY;// and now bind my socketif (bind(mySocket, (sockaddr*)&server, sizeof(server)) == SOCKET_ERROR) {m_errorData.AddString(d +"Bind failed");UpdateData(TRUE);errorlog("ERROR : Bind failed");closesocket(mySocket);return;}// mark my socket for listeningif (listen(mySocket, 5) == SOCKET_ERROR) {m_errorData.AddString(d +"Listen failed");UpdateData(TRUE);errorlog("ERROR : Listen failed");closesocket(mySocket);return;}// get local ip address    char ac[80];if (gethostname(ac, sizeof(ac)) == SOCKET_ERROR) {return;}    struct hostent *phe = gethostbyname(ac);if (phe == 0) {return;}    for (int i = 0; phe->h_addr_list != 0; ++i){struct in_addr addr;memcpy(&addr, phe->h_addr_list, sizeof(struct in_addr));localIP = inet_ntoa(addr);// send message to user startet with successm_strMessage1 = "Online";UpdateData(FALSE);m_listData.AddString(d +"Server startup success &#111;n IP : " +localIP);UpdateData(TRUE);connectlog("Server startet with success &#111;n IP :");}}// shut down winsock2void shutdownServer(int socket){    // close our socketclosesocket(socket);// shut down winsockWSACleanup();}and call em from my other filelike startupServerForListening(2003);however, when i try to set it up to listen & accept for connections, my pc goes to 99% resources used and program dont even start (no errors it just dont show itself).anyone can guess why ?anyone got a sollution (perhaps another way of init winsock or sumthing ?)any help would be awesome.Thanks.Bo B.  </i>  
  Make sure your loops have a exit condition so that they don't go on for ever. Some printfs should give you the answers. This is just a guess of course.   [edited by - doho on February 12, 2004 11:35:53 AM];  mm i tryed to set it up using some stuff i found on the net about it i made different void''s and so for it, it works fine except i get 1 error and thats :warning C4183: ''main'': member function definition looks like a ctor, but name does not match enclosing classcode looks like this :#define PORTNUM 50000 void do_something(SOCKET);main(){SOCKET s;if ((s = establish(PORTNUM)) == INVALID_SOCKET){    perror("establish");    exit(1);}for (;{ /* loop for calls */    SOCKET new_sock = accept(s, NULL, NULL);    if (s == INVALID_SOCKET) { fprintf(stderr, "Error waiting for new connection!\n"); exit(1);    }    do_something(new_sock);    closesocket(new_sock);}}so my question is, what does this error mean, how do i fix that ctor thing ?(still using visual c++ its a MFC application just so you know) ;  perhaps your main function should be changed to int main() or void main() ;  changed it to int main(), now no errors *duh* 