?? ua_time.txt
字號:
---------------------------------------------------
UA_TIME.EXE: daytime client and server application
---------------------------------------------------
This application is referenced in Chapter 5, "Operation Modes"
of _Windows Sockets Network Programming_ by Bob Quinn and Dave
Shute, published by Addison-Wesley, Reading, MA ISBN: 0-201-63372-8
What it does: UA_TIME works as a client and a server using
UDP in asynchronous operation mode to implement the simple daytime
protocol, as described in RFC 867. As a client, it sends a datagram
to the daytime service (port 13), then reads the response, which
contains a human-readable string indicating the current date and
time maintained by the daytime server system. As a server, it
responds to each unsolicited datagram received on port 13, but
returning a human-readable date/time string.
What it illustrates: It shows how to create a combination
client and server that uses a UDP socket RFC 768 and asynchronous
operation mode. It also allows uses setsockopt() SO_BROADCAST
to allow sending and recieving broadcast datagrams.
How to Use it: The program starts without a socket, so
the first thing you need to do is use the "Open" command
to get a socket, and call bind(). You then use "Sendto"
to send requests to daytime server systems. If you use "Options"
to enable the use of broadcast destination addresses, you can
send to the limited broadcast address (255.255.255.255) to query
all the hosts on your local network. Each time a response is received,
UA_TIME displays the time/date string along with the source address
in a message box.
Known Problems: This application should display each response
in a scrolling window rather than displaying a message box for
each.
File List:
UA_TIME\UA_TIME.DEF
UA_TIME\UA_TIME.ICO
UA_TIME\RESOURCE.H
UA_TIME\UA_TIME.MAK Makefile for 16-bit ua_time.exe
UA_TIME\UATIME32.MAK Makefile for 32-bit uatime32.exe
UA_TIME\UA_TIME.RC
UA_TIME\UA_TIME.C
--------
NOTES:
--------
We used Microsoft Visual C++ enviroments (versions 1.52 for 16-bit,
and version 2.1 for 32-bit) to create most of the makefiles.
Unfortunately, because the paths are hard-coded in the file, you will
have to bring the project files (.mak) into the respective MS C++
environments to readjust things to the new directory, and even then
you will have to manually alter the project to access the library
files (the are in the root of the directory where you install the
samples).
All samples--including the sample DLL and static library--have a
number of other things in common:
- They all have 32-bit versions, and all 32-bit version names
end with "32" (16-bit versions don't have a number).
- They use the WSAperror() function from #WINSOCKX">WINSOCKX.LIB
to display error values and short descriptions when an unexpected
error occurs.
- They display error messages on any suspicious error condition.
They don't hide errors, but report them whenever they occur. As
we describe n a_c.htm">Appendix C: WinSock Error Reference,
these error messages should appear only when a "user fixable
error" occurs. If you get an error message from a sample
application for a non user-fixable error, then this may
indicate an anomoly in the WinSock implementation that your applications
may need to deal with. We show you the errors on purpose, to make
you aware of unexpected conditions.
- They have a minimal user interface, and do not have help (.HLP)
files available.
- They are meant to be played with. They are for exploration
and experimentation as well as to illustrate how to write WinSock
applications.
The icons used for each sample don't mean much, but they meet
the following three criteria:
- They each contain the socket from the official WinSock icon.
- Each one is colorful in its own unique and wonderful way.
- Each took under 10 minutes to create.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -