本帖最后由 VisualEleven 于 2011-11-24 10:45:45 编辑

解决方案 »

  1.   

    返回-1表示有错误,用WSAGetLastError看看返回什么错误
    我没看到楼主的使用socket之类的函数创建套接字,不知道楼主的套接字怎么生成的
      

  2.   

    我在Oninitdialog中初始化了客户端与服务端的SOCKET,因为我这个程序既是客户端又是服务端!
      

  3.   

    WSAGetLastError()返回的值是什么看看不就清楚了
      

  4.   

    Socket operation on nonsocket. 
    An operation was attempted on something that is not a socket. Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid.
    你的那个不是正确的套接字,你套作fd_set的方法不对
    楼主上网查查怎么操作