锘??xml version="1.0" encoding="utf-8" standalone="yes"?>在线免费看h,国产欧美一区二区三区久久,国产一区二区三区久久久http://www.aygfsteel.com/hwpok/category/49497.htmlDEBUG - 澶╅亾閰嫟zh-cnFri, 21 Oct 2011 19:08:37 GMTFri, 21 Oct 2011 19:08:37 GMT60- TCP涓鐐逛笢涓?/title>http://www.aygfsteel.com/hwpok/archive/2011/10/22/361772.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Fri, 21 Oct 2011 16:51:00 GMThttp://www.aygfsteel.com/hwpok/archive/2011/10/22/361772.htmlhttp://www.aygfsteel.com/hwpok/comments/361772.htmlhttp://www.aygfsteel.com/hwpok/archive/2011/10/22/361772.html#Feedback0http://www.aygfsteel.com/hwpok/comments/commentRss/361772.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/361772.htmlpackage org.upeng.mail.net.server;import java.io.BufferedReader;import java.io.Buffered... 闃呰鍏ㄦ枃

]]> - (杞?MINA2 涔婭oBuffer http://www.aygfsteel.com/hwpok/archive/2011/09/05/357953.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Sun, 04 Sep 2011 16:40:00 GMThttp://www.aygfsteel.com/hwpok/archive/2011/09/05/357953.htmlhttp://www.aygfsteel.com/hwpok/comments/357953.htmlhttp://www.aygfsteel.com/hwpok/archive/2011/09/05/357953.html#Feedback0http://www.aygfsteel.com/hwpok/comments/commentRss/357953.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/357953.html鏈榪戝仛鐨勪竴涓」鐩敤鍒頒簡寮婧愮殑C/S搴旂敤鐨勬湇鍔″櫒妗嗘灦MINA錛屽綋鍒濆仛鐨勬椂鍊欒祫鏂欓潪甯稿皯錛屽彧鑳借嚜宸變笉鍋滅殑嫻嬭瘯錛屾葷粨鍑轟簡涓浜涜寰嬬粡楠屻備粠緗戜笂鐪嬬殑璧勬枡涓婄湅錛岃繖涓湇鍔″櫒妗嗘灦榪樻槸姣旇緝紼沖畾鍜屾敮鎸佺殑騫跺彂鏁拌繕鏄緢涓嶉敊鐨勶紝涓嶈繃... 闃呰鍏ㄦ枃

]]> - (杞?Mina 妗嗘灦鎬葷粨http://www.aygfsteel.com/hwpok/archive/2011/09/04/357931.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Sat, 03 Sep 2011 18:28:00 GMThttp://www.aygfsteel.com/hwpok/archive/2011/09/04/357931.htmlhttp://www.aygfsteel.com/hwpok/comments/357931.htmlhttp://www.aygfsteel.com/hwpok/archive/2011/09/04/357931.html#Feedback0http://www.aygfsteel.com/hwpok/comments/commentRss/357931.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/357931.html綆鍗曚粙緇嶏細MINA妗嗘灦鏄java鐨凬IO鍖呯殑涓涓皝瑁咃紝綆鍖栦簡NIO紼嬪簭寮鍙戠殑闅懼害錛屽皝瑁呬簡寰堝搴曞眰鐨勭粏鑺傦紝鐒跺紑鍙戣呮妸綺懼姏闆嗕腑鍒頒笟鍔¢昏緫涓婃潵錛屾渶榪戝仛浜嗕竴涓浉鍏崇殑欏圭洰錛屼負浜嗗蹇樺MINA鍋氫竴涓葷粨銆?/p>
涓嬮潰榪欎釜start鏂規硶鐢ㄦ潵鍒濆鍖朚INA錛?/p>
- private void start(int port, WebContext ctx)
- throws IOException, InstantiationException
- , IllegalAccessException, ClassNotFoundException {
-
- NioSocketAcceptor acceptor = new NioSocketAcceptor(5);
-
- java.util.concurrent.Executor threadPool = Executors.newFixedThreadPool(1500);
-
- acceptor.getFilterChain().addLast("exector", new ExecutorFilter(threadPool));
- acceptor.getFilterChain().addLast("codec",
- new ProtocolCodecFilter(new WebDecoder()錛?span class="keyword">new WebEncoder()));
- LoggingFilter filter = new LoggingFilter();
- filter.setExceptionCaughtLogLevel(LogLevel.DEBUG);
- filter.setMessageReceivedLogLevel(LogLevel.DEBUG);
- filter.setMessageSentLogLevel(LogLevel.DEBUG);
- filter.setSessionClosedLogLevel(LogLevel.DEBUG);
- filter.setSessionCreatedLogLevel(LogLevel.DEBUG);
- filter.setSessionIdleLogLevel(LogLevel.DEBUG);
- filter.setSessionOpenedLogLevel(LogLevel.DEBUG);
- acceptor.getFilterChain().addLast("logger", filter);
-
- acceptor.setReuseAddress(true);
-
- acceptor.getSessionConfig().setReuseAddress(true);
- acceptor.getSessionConfig().setReceiveBufferSize(1024);
- acceptor.getSessionConfig().setSendBufferSize(10240);
-
- acceptor.getSessionConfig().setTcpNoDelay(true);
-
- acceptor.setBacklog(100);
- acceptor.setDefaultLocalAddress(new InetSocketAddress(port));
-
- acceptor.setHandler(new WebHandler());
- acceptor.bind();
- }
NioSocketAcceptor鏄疢INA鐨勯傞厤鍣紝涓鍒囬兘鏄粠榪欓噷寮濮嬬殑銆侻INA涓湁涓繃婊ゅ櫒鍜屽鐞嗗櫒鐨勬蹇碉紝榪囨護鍣ㄧ敤鏉ヨ繃婊ゆ暟鎹紝澶勭悊鍣ㄧ敤鏉ュ鐞嗘暟鎹傚叿浣撴潵璇碝INA鐨勫鐞嗘ā鍨嬪氨鏄痳equest->榪囨護鍣ˋ->榪囨護鍣˙->澶勭悊鍣?>榪囨護鍣˙->榪囨護鍣ˋ->response,榪欓噷鐨剅equest鍜宺esponse綾諱技serlvet鐨剅equest鍜宺esponse銆?/p>
- acceptor.getFilterChain().addLast("exector", new ExecutorFilter(threadPool));
-
- acceptor.getFilterChain().addLast("codec",
- new ProtocolCodecFilter(new WebDecoder()錛?span class="keyword">new WebEncoder()));
-
-
鐜板湪璇︾粏鎻忚堪涓涓媟equest->WebDecoder->WebHandler->WebEncode->response鐨勮繃紼嬶細
瀹㈡埛绔彂閫佷竴涓姹傚埌MINA鏈嶅姟鍣紝榪欓噷鐩稿綋浜庢潵浜嗕竴涓猺equet銆傝姹傞鍏堟潵鍒?/p>
- WebDecoder綾?瀹炵幇浜哖rotocolDecoder鎺ュ彛)涓殑
- boolean decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception{}鏂規硶
-
-
-
-
-
-
-
-
-
-
鐒跺悗鍒?/p>
- WebHandler(鎵╁睍浜咺oHandlerAdapter鎶借薄綾?涓殑
- void messageReceived(IoSession session, Object message) throws Exception{}鏂規硶
- WriteFuture future = session.write(response);
- future.addListener(IoFutureListener.CLOSE);
- IoFutureListener閲岄潰鏈変釜operationComplete(IoFuture future)鏂規硶錛屽綋嫻佸彂閫佸畬鎴愪箣鍚庢墠璋冪敤榪欎釜鏂規硶銆?
-
-
-
-
-
-
鐒跺悗鍒?/p>
- WebEncoder綾?瀹炵幇浜哖rotocolEncoder鎺ュ彛)涓殑
- boolean encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception{}
- 鏂規硶
-
-
-
-
-
-
-

]]> - socketPoolhttp://www.aygfsteel.com/hwpok/archive/2011/08/30/357594.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Tue, 30 Aug 2011 10:01:00 GMThttp://www.aygfsteel.com/hwpok/archive/2011/08/30/357594.htmlhttp://www.aygfsteel.com/hwpok/comments/357594.htmlhttp://www.aygfsteel.com/hwpok/archive/2011/08/30/357594.html#Feedback0http://www.aygfsteel.com/hwpok/comments/commentRss/357594.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/357594.html
package example.helloword.client;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class SendMsgPool


{
private static SendMsgPool sendMsgPool = new SendMsgPool();
private ExecutorService pool;
private SendMsgPool()

{
pool = Executors.newFixedThreadPool(3);
}
public static SendMsgPool getInstance()

{
return sendMsgPool;
}
public Future<String> sendMsg(String local, int port, String msg)

{
ClinetSocket clientScoket = ClientSocketPool.getInstance()
.getClientSocket(local, port);
ClientTread ct = new ClientTread(clientScoket, msg);
return pool.submit(ct);
}
public void shutDown()

{
this.pool.shutdown();
}
}


]]>- apache mina妗嗘灦灝忚瘯http://www.aygfsteel.com/hwpok/archive/2011/08/30/357563.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Tue, 30 Aug 2011 05:11:00 GMThttp://www.aygfsteel.com/hwpok/archive/2011/08/30/357563.htmlhttp://www.aygfsteel.com/hwpok/comments/357563.htmlhttp://www.aygfsteel.com/hwpok/archive/2011/08/30/357563.html#Feedback1http://www.aygfsteel.com/hwpok/comments/commentRss/357563.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/357563.htmlpackage server;import java.net.InetSocketAddress;import org.apache.mina.core... 闃呰鍏ㄦ枃

]]> - jboss netty 妗嗘灦灝忚瘯http://www.aygfsteel.com/hwpok/archive/2011/08/30/357562.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Tue, 30 Aug 2011 05:07:00 GMThttp://www.aygfsteel.com/hwpok/archive/2011/08/30/357562.htmlhttp://www.aygfsteel.com/hwpok/comments/357562.htmlhttp://www.aygfsteel.com/hwpok/archive/2011/08/30/357562.html#Feedback0http://www.aygfsteel.com/hwpok/comments/commentRss/357562.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/357562.htmlpackage example.helloword.server;import java.net.InetSocketAddress;import ja... 闃呰鍏ㄦ枃

]]> - java 綆鍗晄ocket 閫氫俊http://www.aygfsteel.com/hwpok/archive/2011/08/26/357328.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Fri, 26 Aug 2011 02:28:00 GMThttp://www.aygfsteel.com/hwpok/archive/2011/08/26/357328.htmlhttp://www.aygfsteel.com/hwpok/comments/357328.htmlhttp://www.aygfsteel.com/hwpok/archive/2011/08/26/357328.html#Feedback0http://www.aygfsteel.com/hwpok/comments/commentRss/357328.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/357328.htmlpackage sterning;import java.io.BufferedReader;import java.io.IOException;import... 闃呰鍏ㄦ枃

]]> - [杞琞JAVA-鐢℉ttpClient鏉ユā鎷熸祻瑙堝櫒GET,POST http://www.aygfsteel.com/hwpok/archive/2011/08/24/357152.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Tue, 23 Aug 2011 16:08:00 GMThttp://www.aygfsteel.com/hwpok/archive/2011/08/24/357152.htmlhttp://www.aygfsteel.com/hwpok/comments/357152.htmlhttp://www.aygfsteel.com/hwpok/archive/2011/08/24/357152.html#Feedback0http://www.aygfsteel.com/hwpok/comments/commentRss/357152.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/357152.html闃呰鍏ㄦ枃

]]> - UDPhttp://www.aygfsteel.com/hwpok/archive/2010/12/25/341528.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Sat, 25 Dec 2010 12:46:00 GMThttp://www.aygfsteel.com/hwpok/archive/2010/12/25/341528.htmlhttp://www.aygfsteel.com/hwpok/comments/341528.htmlhttp://www.aygfsteel.com/hwpok/archive/2010/12/25/341528.html#Feedback0http://www.aygfsteel.com/hwpok/comments/commentRss/341528.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/341528.html
while (true)
{
try
{
// 鎺ユ敹鏁版嵁
datagramSocket.receive(datagramPacket);
String instruction = new String(datagramPacket.getData(), 0, datagramPacket.getLength());
System.out.println(instruction);
String senddStr = "from remote server: " + instruction;
System.out.println("datagramPacket-port: " + datagramPacket.getPort());
System.out.println("datagramPacket-addr: " + datagramPacket.getAddress().getHostAddress());
this.send(datagramPacket.getAddress().getHostAddress(), datagramPacket.getPort(), senddStr);
}
catch (Exception e)
{
e.printStackTrace();
}
}

]]> - java 寰楀埌鏈満鎵鏈塱phttp://www.aygfsteel.com/hwpok/archive/2010/12/01/339464.html鎯犱竾楣?/dc:creator>鎯犱竾楣?/author>Wed, 01 Dec 2010 00:44:00 GMThttp://www.aygfsteel.com/hwpok/archive/2010/12/01/339464.htmlhttp://www.aygfsteel.com/hwpok/comments/339464.htmlhttp://www.aygfsteel.com/hwpok/archive/2010/12/01/339464.html#Feedback0http://www.aygfsteel.com/hwpok/comments/commentRss/339464.htmlhttp://www.aygfsteel.com/hwpok/services/trackbacks/339464.html
public static String[] getAllLocalHostIP()

{
String[] ret = null;
try

{
String hostName = InetAddress.getLocalHost().getHostName();
if (hostName == null || hostName.length() < 1)

{
return ret;
}
InetAddress[] inetAddresses = InetAddress.getAllByName(hostName);
if (inetAddresses == null || inetAddresses.length < 1)

{
return ret;
}
ret = new String[inetAddresses.length];
for (int i = 0; i < inetAddresses.length; i++)

{
ret[i] = inetAddresses[i].getHostAddress();
}
}
catch (Exception ex)

{
ex.printStackTrace();
}
return ret;
}

]]>
主站蜘蛛池模板:
永德县|
江都市|
阿拉善右旗|
永和县|
区。|
磐石市|
湖州市|
澄城县|
聊城市|
庄河市|
留坝县|
南陵县|
中山市|
台中市|
静安区|
河源市|
崇州市|
独山县|
石景山区|
朝阳区|
奉贤区|
吴桥县|
栾城县|
大同县|
岐山县|
富民县|
无棣县|
保定市|
大关县|
洪湖市|
邯郸市|
广宁县|
孟连|
偃师市|
三都|
全南县|
二手房|
青阳县|
彩票|
乌拉特后旗|
灌阳县|