服务器(Windows SP3)有两个局域网卡(局域网卡A和B),并连接到互联网使用ADSL。ADSL连接通过Internet连接共享共享到网卡B。
客户端(Windows SP3)有一张局域网卡,并连接到服务器的局域网卡B,使其能够访问互联网。
局域网卡上的IP地址定义如下:
Server:
LAN card A: 192.168.0.3/24 (manually defined by me)
LAN card B: 192.168.0.1/24 (manually defined by Internet Connection Sharing)
Client:
LAN card: 1
基本上,我有一个由apache在端口1900上运行的网页,还有一个运行在端口3000上的NodeJS服务器。服务器代码:
var express = require('express');
var http = require('http');
//make sure you keep this order
var app = express();
var server = http.createServer(app);
var io = require('socket.io').listen(server);
var port = 3000;