This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<dns> | |
<retcode>0</retcode> | |
<domainlist> | |
<domain name="extshort.weixin.qq.com" timeout="1800"> | |
<ip>101.226.76.175</ip> | |
<ip>101.227.131.102</ip> | |
</domain> | |
<domain name="long.weixin.qq.com" timeout="1800"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [email protected] | |
* how to compile it: | |
* gcc pong_server.c -o pong_server /usr/local/lib/libev.a -lm | |
*/ | |
#include <arpa/inet.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <fcntl.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Ping Client | |
* @author nieyong | |
*/ | |
package com.learn; | |
import io.netty.bootstrap.Bootstrap; | |
import io.netty.buffer.ByteBuf; | |
import io.netty.buffer.PooledByteBufAllocator; | |
import io.netty.channel.ChannelFuture; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set CLASSPATH=. | |
nohup java -server -Xmx6G -Xms6G -Xmn600M -XX:PermSize=50M -XX:MaxPermSize=50M -Xss256K -XX:+DisableExplicitGC -XX:SurvivorRatio=1 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:+CMSClassUnloadingEnabled -XX:LargePageSizeInBytes=128M -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:gc.log -Djava.ext.dirs=lib com.test.server.HttpChunkedServer 8000 >server.out 2>&1 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test.server; | |
import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE; | |
import static org.jboss.netty.handler.codec.http.HttpMethod.GET; | |
import static org.jboss.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST; | |
import static org.jboss.netty.handler.codec.http.HttpResponseStatus.METHOD_NOT_ALLOWED; | |
import static org.jboss.netty.handler.codec.http.HttpResponseStatus.OK; | |
import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1; | |
import java.util.concurrent.atomic.AtomicInteger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test.server; | |
import static org.jboss.netty.channel.Channels.pipeline; | |
import java.net.InetSocketAddress; | |
import java.util.concurrent.Executors; | |
import org.jboss.netty.bootstrap.ServerBootstrap; | |
import org.jboss.netty.channel.ChannelPipeline; | |
import org.jboss.netty.channel.ChannelPipelineFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/tcp.h> | |
#include <netinet/in.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(htmlfile_handler). | |
-behaviour(cowboy_loop_handler). | |
-export([init/3, info/3, terminate/3]). | |
-define(HEARBEAT_TIMEOUT, 20*1000). | |
-record(status, {count=0}). | |
init(_Any, Req, State) -> | |
NowCount = count_server:welcome(), | |
io:format("online user ~p~n", [NowCount]), | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(cowboy_loop_handler). | |
-type opts() :: any(). | |
-type state() :: any(). | |
-type terminate_reason() :: {normal, shutdown} | |
| {normal, timeout} | |
| {error, atom()}. | |
%% 处理用户第一次请求,可以处理请求,为当前会话生成状态数据,进行等待或者休眠,或者关闭掉当前会话。 | |
-callback init({atom(), http}, Req, opts()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <sys/time.h> | |
#include <sys/queue.h> | |
#include <stdlib.h> | |
#include <err.h> | |
#include <event.h> | |
#include <evhttp.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <string.h> |