This file contains hidden or 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
var app = require('app') | |
var BrowserWindow = require('browser-window') | |
var net = require('net'); | |
var HOST = '192.168.1.36'; | |
var PORT = 2401; | |
app.on('ready', function(){ | |
var mainWindow = new BrowserWindow({fullscreen: true, "node-integration": false}) |
This file contains hidden or 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
func echoService(client c:TCPClient){ | |
println("newclient from:\(c.addr)[\(c.port)]") | |
var d=c.read(1024*10) | |
c.send(data: d!) | |
println(d) | |
c.close() | |
} | |
func testserver(){ | |
var server:TCPServer = TCPServer(addr: "127.0.0.1", port: 7777) | |
var (success,msg)=server.listen() |
This file contains hidden or 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
while true{ | |
if var client=server.accept(){ | |
echoService(client: client) | |
var data=client.read(1024*10) | |
if let d=data{ | |
if let str=String.stringWithBytes(d, length: d.count, encoding: NSUTF8StringEncoding){ | |
println(str) | |
} | |
} | |
}else |
This file contains hidden or 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
var data=client.read(1024*10) | |
if let d=data{ | |
if let str=String(d.map { Character(UnicodeScalar($0)) }){ | |
println(str) | |
} | |
} |
This file contains hidden or 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
let str=String(d.map { Character(UnicodeScalar($0)) }){ | |
println(str) | |
} |
This file contains hidden or 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
func testserver(){ | |
var server:TCPServer = TCPServer(addr: "127.0.0.1", port: 7777) | |
var (success,msg)=server.listen() | |
if success{ | |
while true{ | |
if var client=server.accept(){ | |
echoService(client: client) | |
var data=client.read(1024*10) | |
if let d=data{ | |
let str=String(d.map { Character(UnicodeScalar($0)) }) |
This file contains hidden or 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
func testserver(){ | |
var server:TCPServer = TCPServer(addr: "127.0.0.1", port: 7777) | |
var (success,msg)=server.listen() | |
if success{ | |
while true{ | |
if var client=server.accept(){ | |
echoService(client: client) | |
var data=client.read(1024*10) | |
let str = NSString(bytes: data!, length: data!.count, encoding: NSUTF8StringEncoding) |
This file contains hidden or 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
func testserver(){ | |
var server:TCPServer = TCPServer(addr: "127.0.0.1", port: 7777) | |
var (success,msg)=server.listen() | |
if success{ | |
while true{ | |
if var client=server.accept(){ | |
echoService(client: client) | |
var data=client.read(1024*10) | |
if let str = NSString(bytes: data!, length: data!.count, encoding: NSUTF8StringEncoding) { |
This file contains hidden or 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
var http = require('http'); | |
var express=require('express'); | |
var net = require ('net'); | |
var app = express(); | |
app.use(express.static(__dirname + '/public')); | |
/* LISTE DE TOUTES LES COMMANDES ICI LIEES AU VIDEODATA.TXT */ | |
var commands = { |
This file contains hidden or 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
Error: This socket has been ended by the other party | |
at Socket.writeAfterFIN [as write] (net.js:275:12) | |
at Object.handle (/Users/mika/Downloads/client.js:23:14) | |
at next_layer (/Users/mika/Downloads/node_modules/express/lib/router/route.js:103:13) | |
at Route.dispatch (/Users/mika/Downloads/node_modules/express/lib/router/route.js:107:5) | |
at /Users/mika/Downloads/node_modules/express/lib/router/index.js:213:24 | |
at Function.proto.process_params (/Users/mika/Downloads/node_modules/express/lib/router/index.js:286:12) | |
at next (/Users/mika/Downloads/node_modules/express/lib/router/index.js:207:19) | |
at Layer.staticMiddleware [as handle] (/Users/mika/Downloads/node_modules/express/node_modules/serve-static/index.js:67:61) | |
at trim_prefix (/Users/mika/Downloads/node_modules/express/lib/router/index.js:254:17) |