Socket

所属分类:Telnet服务器
开发工具:Visual C++
文件大小:826KB
下载次数:6
上传日期:2008-02-26 11:17:00
上 传 者闪闪红星87
说明:  运用Socket编程实现的客户端以及服务器,可以实现聊天功能
(Use Socket Programming client and server, you can realize chat)

文件列表:
Socket\MFC\chatsrvr\chatsrvr.clw (2154, 1998-03-27)
Socket\MFC\chatsrvr\chatsrvr.cpp (3670, 1998-03-27)
Socket\MFC\chatsrvr\chatsrvr.dsp (7858, 1998-03-27)
Socket\MFC\chatsrvr\chatsrvr.dsw (539, 1998-03-27)
Socket\MFC\chatsrvr\chatsrvr.h (1389, 1998-03-27)
Socket\MFC\chatsrvr\chatsrvr.mak (11408, 1998-03-27)
Socket\MFC\chatsrvr\chatsrvr.ncb (173056, 2008-03-17)
Socket\MFC\chatsrvr\chatsrvr.opt (49664, 2008-03-17)
Socket\MFC\chatsrvr\chatsrvr.plg (250, 2008-03-17)
Socket\MFC\chatsrvr\chatsrvr.rc (8101, 1998-03-27)
Socket\MFC\chatsrvr\clntsock.cpp (2301, 1998-03-27)
Socket\MFC\chatsrvr\clntsock.h (1447, 1998-03-27)
Socket\MFC\chatsrvr\Debug (0, 2007-12-12)
Socket\MFC\chatsrvr\dialogs.cpp (1437, 1998-03-27)
Socket\MFC\chatsrvr\dialogs.h (1226, 1998-03-27)
Socket\MFC\chatsrvr\lstnsock.cpp (1280, 1998-03-27)
Socket\MFC\chatsrvr\lstnsock.h (1188, 1998-03-27)
Socket\MFC\chatsrvr\mainfrm.cpp (3006, 1998-03-27)
Socket\MFC\chatsrvr\mainfrm.h (1447, 1998-03-27)
Socket\MFC\chatsrvr\makefile (561, 1998-03-27)
Socket\MFC\chatsrvr\msg.cpp (1702, 1998-03-27)
Socket\MFC\chatsrvr\msg.h (998, 1998-03-27)
Socket\MFC\chatsrvr\res\chatsrvr.ico (1078, 1998-03-27)
Socket\MFC\chatsrvr\res\chatsrvr.rc2 (400, 1998-03-27)
Socket\MFC\chatsrvr\res\toolbar.bmp (838, 1998-03-27)
Socket\MFC\chatsrvr\res (0, 2007-12-12)
Socket\MFC\chatsrvr\resource.h (1000, 1998-03-27)
Socket\MFC\chatsrvr\srvrdoc.cpp (6059, 1998-03-27)
Socket\MFC\chatsrvr\srvrdoc.h (1876, 1998-03-27)
Socket\MFC\chatsrvr\srvrvw.cpp (2109, 1998-03-27)
Socket\MFC\chatsrvr\srvrvw.h (1603, 1998-03-27)
Socket\MFC\chatsrvr\stdafx.cpp (519, 1998-03-27)
Socket\MFC\chatsrvr\stdafx.h (678, 1998-03-27)
Socket\MFC\chatsrvr (0, 2007-12-10)
Socket\MFC\chatter\chatdoc.cpp (6357, 1998-03-27)
Socket\MFC\chatter\chatdoc.h (1655, 1998-03-27)
Socket\MFC\chatter\chatsock.cpp (902, 1998-03-27)
Socket\MFC\chatter\chatsock.h (832, 1998-03-27)
Socket\MFC\chatter\Chatter.aps (30548, 2007-04-13)
Socket\MFC\chatter\chatter.clw (2166, 1998-03-27)
... ...

Demonstration of the Windows Sockets API SUMMARY ======= The WSOCK sample demonstrates the basics of sockets programming, specifically for Windows Sockets. It demonstrates how to accept incoming connections (using the Windows Sockets Asynchronous Extension APIs, threads, and traditional BSD-style blocking calls) and how to connect to remote hosts. Once connected, you can send a text string to the remote host. WSOCK also allows the user to view information on a user-entered host name. WSOCK demonstrates how to use AcceptEx which is a Microsoft specific extension to Windows Sockets and which is only supported on Windows NT. MORE INFORMATION ================ For the sample to operate correctly, the TCP/IP protocol must be properly installed. Also, if two machines are used over a network, both machines must have a HOSTS text file (for Windows NT machines, this file is located in %SYSTEMROOT%\SYSTEM32\DRIVERS\ETC\HOSTS; for Windows for Workgroups machines, this file is located in C:/WINDOWS/HOSTS). Within each HOSTS file, both the remote and local addresses of both machines must be listed. WSOCK can run on a single machine (execute two copies of WSOCK) or over a network with two machines. The following example explains how two separate machines over a network would test WSOCK: 1. Machine "Bob" executes a copy of WSOCK. 2. Machine "Fred" executes a copy of WSOCK. 3. Machine "Bob" chooses one of the Listen menu options (under WinSock) [Listen (Blocking), Listen With Threads, or Async Listen]. 4. Machine "Fred" selects the Connect menu option (under WinSock). 5. Machine "Bob" enters "12" as a TCP port number. 6. Machine "Bob" waits for a connection. 7. Machine "Fred" enters "Bob" as the host name to connect to. 8. Machine "Fred" enters "12" as a TCP port number. Both machines are now connected and can send strings back and forth by using the WinSock Send Message menu option. If Bob exits WSOCK while there is a connection, Fred receives a message box notification. FUNCTIONS USED ============== accept closesocket connect gethostbyname getservbyname htons listen send recv WSAAsyncSelect WSACleanup WSAStartup

近期下载者

相关文件


收藏者