using java connect it, error : 试图超越文件尾对文件进行读写.Server is the MSDN sample CHATSRVRhelp!!! help!!!!谁能用 WinSocket api 写一个程序 
发送字符到 CHATSRVR 
在CHATSRVR 上显示出来就可以
问题的难度就因为CHATSRVR 不是使用的SocketApiCHATSRVR 就是MSDN 上的一个例子 ,在MSDN光盘上就有, 或者到MSDN下载.使用sniffer 监听 CHATTER/CHATSRVR 的数据收发, 然后模仿
我实验过,没成功. 或许我使用的 sniffer 程序有问题,或许我不会使用sniffer.
我用的sniffer是Visual Sniffer Thanks!

解决方案 »

  1.   

    有代码嘛#include <winsock2.h>void main(void)
    {
       WSADATA              wsaData;
       SOCKET               ListeningSocket;
       SOCKET               NewConnection;
       SOCKADDR_IN          ServerAddr;
       SOCKADDR_IN          ClientAddr;
       int                  Port = 5150;
       
       // Initialize Winsock version 2.2   WSAStartup(MAKEWORD(2,2), &wsaData);
       
          // Create a new socket to listen for client connections.
     
          ListeningSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
      
          // Set up a SOCKADDR_IN structure that will tell bind that we
          // want to listen for connections on all interfaces using port
          // 5150. Notice how we convert the Port variable from host byte
          // order to network byte order.
      
          ServerAddr.sin_family = AF_INET;
          ServerAddr.sin_port = htons(Port);    
          ServerAddr.sin_addr.s_addr = htonl(INADDR_ANY);
      
          // Associate the address information with the socket using bind.
      
          bind(ListeningSocket, (SOCKADDR *)&ServerAddr, 
          sizeof(ServerAddr));   // Listen for client connections. We used a backlog of 5, which
       // is normal for many applications.      listen(ListeningSocket, 5);    // Accept a new connection when one arrives.      NewConnection = accept(ListeningSocket, (SOCKADDR *) 
                              &ClientAddr,&ClientAddrLen));   // At this point you can do two things with these sockets. Wait
       // for more connections by calling accept again on ListeningSocket
       // and start sending or receiving data on NewConnection. We will
       // describe how to send and receive data later in the chapter.   // When you are finished sending and receiving data on the
       // NewConnection socket and are finished accepting new connections
       // on ListeningSocket, you should close the sockets using the
       // closesocket API. We will describe socket closure later in the 
       // chapter.      closesocket(NewConnection);
          closesocket(ListeningSocket);   // When your application is finished handling the connections, 
       // call WSACleanup.      WSACleanup();
    }
      

  2.   

    www.vckbase.com
    上面一大堆,修改服务器的端口号和ip地址就可以直接使用了
      

  3.   

    www.vckabse.com
    自己去下载,现成的程序
      

  4.   

    www.vckbase.com上面有很多例子,自己找一个看看吧