<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FNetwork_Protocol%2FServerSocketChannel</id>
		<title>Java/Network Protocol/ServerSocketChannel - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FNetwork_Protocol%2FServerSocketChannel"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Network_Protocol/ServerSocketChannel&amp;action=history"/>
		<updated>2026-04-10T06:53:23Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/Network_Protocol/ServerSocketChannel&amp;diff=8929&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Network_Protocol/ServerSocketChannel&amp;diff=8929&amp;oldid=prev"/>
				<updated>2010-06-01T07:21:46Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 07:21, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/Network_Protocol/ServerSocketChannel&amp;diff=8928&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/Network_Protocol/ServerSocketChannel&amp;diff=8928&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== A simple TCP server for the daytime service ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2004 David Flanagan.  All rights reserved.&lt;br /&gt;
 * This code is from the book Java Examples in a Nutshell, 3nd Edition.&lt;br /&gt;
 * It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied.&lt;br /&gt;
 * You may study, use, and modify it for any non-commercial purpose,&lt;br /&gt;
 * including teaching and use in open-source projects.&lt;br /&gt;
 * You may distribute it non-commercially as long as you retain this notice.&lt;br /&gt;
 * For a commercial use license, or to purchase the book, &lt;br /&gt;
 * please visit http://www.davidflanagan.ru/javaexamples3.&lt;br /&gt;
 */&lt;br /&gt;
//package je3.nio;&lt;br /&gt;
import java.net.InetSocketAddress;&lt;br /&gt;
import java.nio.ByteBuffer;&lt;br /&gt;
import java.nio.CharBuffer;&lt;br /&gt;
import java.nio.channels.ServerSocketChannel;&lt;br /&gt;
import java.nio.channels.SocketChannel;&lt;br /&gt;
import java.nio.charset.Charset;&lt;br /&gt;
import java.nio.charset.CharsetEncoder;&lt;br /&gt;
/**&lt;br /&gt;
 * A simple TCP server for the daytime service. See RFC867 for details. This&lt;br /&gt;
 * implementation lacks meaningful exception handling and cannot handle UDP&lt;br /&gt;
 * connections.&lt;br /&gt;
 */&lt;br /&gt;
public class SimpleDaytimeServer {&lt;br /&gt;
  public static void main(String args[]) throws java.io.IOException {&lt;br /&gt;
    // RFC867 specifies port 13 for this service. On Unix platforms,&lt;br /&gt;
    // you need to be running as root to use that port, so we allow&lt;br /&gt;
    // this service to use other ports for testing.&lt;br /&gt;
    int port = 13;&lt;br /&gt;
    if (args.length &amp;gt; 0)&lt;br /&gt;
      port = Integer.parseInt(args[0]);&lt;br /&gt;
    // Create a channel to listen for connections on.&lt;br /&gt;
    ServerSocketChannel server = ServerSocketChannel.open();&lt;br /&gt;
    // Bind the channel to a local port. Note that we do this by obtaining&lt;br /&gt;
    // the underlying java.net.ServerSocket and binding that socket.&lt;br /&gt;
    server.socket().bind(new InetSocketAddress(port));&lt;br /&gt;
    // Get an encoder for converting strings to bytes&lt;br /&gt;
    CharsetEncoder encoder = Charset.forName(&amp;quot;US-ASCII&amp;quot;).newEncoder();&lt;br /&gt;
    for (;;) { // Loop forever, processing client connections&lt;br /&gt;
      // Wait for a client to connect&lt;br /&gt;
      SocketChannel client = server.accept();&lt;br /&gt;
      // Build response string, wrap, and encode to bytes&lt;br /&gt;
      String date = new java.util.Date().toString() + &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
      ByteBuffer response = encoder.encode(CharBuffer.wrap(date));&lt;br /&gt;
      // Send the response to the client and disconnect.&lt;br /&gt;
      client.write(response);&lt;br /&gt;
      client.close();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>