接着上一篇
我用的开发工具是sublime
打开之前创建的工程。
打开www
修改并添加代码
#!/usr/bin/env node
var debug = require('debug')('my-application');
var app = require('../app');
var io=require("socket.io").li...
分类:
Web程序 时间:
2014-06-03 04:02:54
阅读次数:
308
看了erlang的一些开源网络框架RabbitMQ、Ranch,他们都使用多个进程同时accept一个socket。这种方式在使得socket端口监听的工作分担了更多的调度机会,但是,在erlang中,socket接受一个新连接后,如果想让另一个进程处理消息,就要显式的调用gen_tcp:controlling_process(Socket, Pid)。所以问题来了,erlang多个进程同时监听一个socket安全吗?文章将会重点讨论这个问题及对这个问题做优化。...
分类:
其他好文 时间:
2014-06-03 03:52:52
阅读次数:
218
测试运行平台:CentOS 6.5发行版,内核版本3.11
1. Linux抓包源程序
在OSI七层模型中,网卡工作在物理层和数据链路层的MAC子层。
进行网络通信时,源主机通过socket(或其它)应用程序产生IP报文,经过各个OSI层层封装,数据包以Ethernet帧的形式进入物理层。Ethernet帧包含源主机地址、IP报文、目标地址(IP地址、端口号或映射的6字节...
分类:
系统相关 时间:
2014-06-03 02:45:05
阅读次数:
428
node,express开发环境等安装假设已经搞好了。
justhacker@justhacker-ThinkPad-Edge-E440:~/projects/nodejs$ express -e chattingnode
create : chattingnode
create : chattingnode/package.json
create : chattin...
分类:
Web程序 时间:
2014-06-03 02:31:27
阅读次数:
285
1. mysql忘记密码
vim /etc/my.conf 文件在mysqld下添加skip-grant-tables,表示mysql在登录的时候不检查权限。登录mysql。直接运行mysql> use mysql;
> update user set Password=password('root') where User='root'
> flush privileges;
> qu...
分类:
数据库 时间:
2014-06-03 02:24:16
阅读次数:
283
链接: http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=2116
Description
Wind and his GF(game friend) are playing a small game. They use the computer to randomly generated a nu...
分类:
其他好文 时间:
2014-06-03 02:17:13
阅读次数:
252
【题目】
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be use...
分类:
其他好文 时间:
2014-06-03 01:07:58
阅读次数:
329
阻塞IO实现:
public class PlainEchoServer {
public void serve(int port) throws IOException {
final ServerSocket socket = new ServerSocket(port);
try {
while (true) {
final Socket clientSocket...
分类:
其他好文 时间:
2014-06-02 23:32:20
阅读次数:
357
如题
#define USE_AND_MASKS
#include
#include
#include
#include
#pragma config OSC = INTIO67 //internal oscillator
#pragma config WDT = OFF //watchdog timer off
#pragma config LVP = OFF...
分类:
其他好文 时间:
2014-06-01 11:16:04
阅读次数:
246
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space....
分类:
其他好文 时间:
2014-06-01 10:41:23
阅读次数:
242