Hello, I've made a simple program that connects to an IRC server. I'm now working on the ident server bit, that listens on port 113. I've come across something rather strange though.
I have two sockets, one that connects to the server on port 6667 and another that listens on port 113. When the socket on port 113 recieves data, it has the correct data at the beginning, but after that it seems to have data from the other socket also..
I'm using asynchronous sockets, here's the problem code:

Code:
case WM_IDENTSOCK:
        {
            switch(WSAGETSELECTEVENT(lParam))
            {
            case FD_ACCEPT:
                {
                    if (WSAGETSELECTERROR(lParam) != 0)
                    {
                        return(FALSE);
                    }
                    IdentSocket= accept(wParam,0,0);
                    return 0 ;
                }
            case FD_READ:
                {
                    char iData[1000];
                    if (WSAGETSELECTERROR(lParam) != 0)
                    {
                        int error    = WSAGetLastError();
                        wsprintf(iData,"%d",error);
                        MessageBox(0,iData,"",0);
                        return false;
                    }
                    int bytes = recv(IdentSocket, iData, sizeof(iData)-1, 0);
                    if(bytes == SOCKET_ERROR)MessageBox(hwnd,"Error in FD_READ, bytes read == SOCKET_ERROR","Error",0);
                    else{
                        MessageBox(0,iData,"",0); //this string seems to have data from the other socket after the correct data
                        iData[bytes] = '\0';
                        MessageBox(0,iData,"",0); //this data is the correct data
                    }
                    return 0;
                }
            case FD_CLOSE:
                {
                    if (WSAGETSELECTERROR(lParam) != 0)
                        return(FALSE);
                    MessageBox(0,"Connection Closed","Ident Server",0);
                    shutdown(IdentSocket,0);
                    WSACleanup();
                    return 0 ;
                }
            }
            return 0;
        }
    case WM_CLIENTSOCK:
        {
            switch(WSAGETSELECTEVENT(lParam))
            {
            case FD_READ:
                {
                    char data[1000];
                    if (WSAGETSELECTERROR(lParam) != 0)
                    {
                        int error    = WSAGetLastError();
                        wsprintf(data,"%d",error);
                        MessageBox(0,data,"",0);
                        return false;
                    }
                    int bytes = recv(wParam, data, sizeof(data)-1, 0);
                    if(bytes == SOCKET_ERROR)MessageBox(hwnd,"Error in FD_READ, bytes read == SOCKET_ERROR","Error",0);
                    else{
                        data[bytes] = '\0';
                        if(string(data).substr(0,4) == "PING")
                        {
                            strncpy(data,"PONG",4);
                            AddData("Ping?");
                            bytes = send(wParam,data, strlen(data),0);
                            if(bytes == SOCKET_ERROR)
                            {
                                int error    = WSAGetLastError();
                                wsprintf(data,"%d",error);
                                MessageBox(0,data,"send() Error",0);
                            }
                            else AddData(" Pong!\r\n");
                        }
                        else AddData(data);
                    }
                    return 0;
                }
            case FD_CLOSE:
                {
                    if (!WSAGETSELECTERROR(lParam))
                        return(FALSE);
                    MessageBox(0,"Connection Closed","",0);
                    shutdown(wParam,0);
                    WSACleanup();
                    return 0 ;
                }
            }
        }
These are my two messages that handle each socket. Any explanation would be good.

Thank you.