<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to main</title><link>https://sourceforge.net/p/runasdog/home/main/</link><description>Recent changes to main</description><atom:link href="https://sourceforge.net/p/runasdog/home/main/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 02 Nov 2011 07:24:11 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/runasdog/home/main/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage main modified by vzex</title><link>https://sourceforge.net/p/runasdog/home/main/</link><description>&lt;pre&gt;--- v6 
+++ v7 
@@ -24,33 +24,33 @@
 
 remote bash server
 ----
-This is a very simple demo,just execute ./runasdog -p port -f -s -e bash,'-f' will remove '\r' from the input buffer,'-s' will telnet the dog that just redirect the i/o without add other informations(This will explain below).
-
+This is a very simple demo,just execute ./runasdog -p port -f -e bash,'-f' will remove '\r' from the input buffer
+
 chatroom server
 ----
 This program is totally written in lua.It shows all of these functions that server can support
 
 function|description
 --------| -----------
 multi-client|look at the pic(chatroom.png)
 broadcast|server send msg to all clients
 server disconnect client directly|look at the pic(chatroom.png)
 not just send one line a time|it is a really tcp server!you can do anything as a normal server do
 server kick clients when the program is done|nothing to explain
 
 How Does It Work
 ====
 ![](https://sourceforge.net/p/runasdog/screenshot/runasdog-how%20it%20works.png)
 
 1.dog create a child progress 'cat',cat where run the command from the arguments,like 'bash'.
 2.dog chat with cat by pipe A and pipe B.
 3.cat input stdout and stderr into pipe A,and read from pipe B.
 4.dog start a server,watch for clients join at server port
 5.dog redirect the message from client to pipe B,receive from pipe A,and redirect them to the client.
 
-What is different between '-s' and without?
+What is different between '-m' and without? (v0.2 replace "-s" with "-m")
 ========
-If with '-s',The server runs simple ,just redirect the whole things.But when there are more than one clients join,server must be able to identify who is who there,and which words of the messages got from cat's stdout/stderr should send where. So,the mode without '-s' comes into being.
+If not with '-m',The server runs simple ,just redirect the whole things.But when there are more than one clients join,server must be able to identify who is who there,and which words of the messages got from cat's stdout/stderr should send where. So,the mode with '-m' comes into being.
 In this mode,cat recv buffers as this format:
 
 |
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vzex</dc:creator><pubDate>Wed, 02 Nov 2011 07:24:11 -0000</pubDate><guid>https://sourceforge.net48cda85399c0929a77c0009130efeeb994755f09</guid></item><item><title>WikiPage main modified by vzex</title><link>https://sourceforge.net/p/runasdog/home/main/</link><description>&lt;pre&gt;--- v5 
+++ v6 
@@ -35,7 +35,7 @@
 multi-client|look at the pic(chatroom.png)
 broadcast|server send msg to all clients
 server disconnect client directly|look at the pic(chatroom.png)
-not just send one line a time|it is a real web server!you can do anything as a normal server do
+not just send one line a time|it is a really tcp server!you can do anything as a normal server do
 server kick clients when the program is done|nothing to explain
 
 How Does It Work
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vzex</dc:creator><pubDate>Mon, 24 Oct 2011 01:59:57 -0000</pubDate><guid>https://sourceforge.netcbf3f94e2cc02c46bb7b34e7ccb3068566ce4dfe</guid></item><item><title>WikiPage main modified by vzex</title><link>https://sourceforge.net/p/runasdog/home/main/</link><description>&lt;pre&gt;--- v4 
+++ v5 
@@ -40,6 +40,8 @@
 
 How Does It Work
 ====
+![](https://sourceforge.net/p/runasdog/screenshot/runasdog-how%20it%20works.png)
+
 1.dog create a child progress 'cat',cat where run the command from the arguments,like 'bash'.
 2.dog chat with cat by pipe A and pipe B.
 3.cat input stdout and stderr into pipe A,and read from pipe B.
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vzex</dc:creator><pubDate>Sun, 23 Oct 2011 17:17:11 -0000</pubDate><guid>https://sourceforge.net4da5c974d80798adfc4dffd8bbe0d18af67c9e51</guid></item><item><title>WikiPage main modified by vzex</title><link>https://sourceforge.net/p/runasdog/home/main/</link><description>&lt;pre&gt;--- v3 
+++ v4 
@@ -6,6 +6,11 @@
 Mail:&lt;vzex@163.com&gt;
 ----
 
+Support System:
+====
+###### Linux,mac os ######
+###### all files are tested on debian,archlinux and mac os. ######
+
 setup
 =====
 1.Check out svn :svn checkout svn://svn.code.sf.net/p/runasdog/code/trunk runasdog-code
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vzex</dc:creator><pubDate>Sat, 22 Oct 2011 04:41:14 -0000</pubDate><guid>https://sourceforge.net5a5310e958778e3991306c67c0d9af9cb453c5f7</guid></item><item><title>WikiPage main modified by vzex</title><link>https://sourceforge.net/p/runasdog/home/main/</link><description>&lt;pre&gt;--- v2 
+++ v3 
@@ -51,6 +51,7 @@
 c5:127.0.0.1:1344|c:connected,5:client pipe id,127.0.0.1:1344 is the client address
 r5:7:hello u|r:received,5:client pipe id,7:content len,hello u:real content from client
 d5:|d:disconnected,5:client pipe id
+
 cat send buff as this format:
 
 |
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vzex</dc:creator><pubDate>Fri, 21 Oct 2011 19:04:38 -0000</pubDate><guid>https://sourceforge.net9a16dd3615b1d357285807eaa13dd110f76f8347</guid></item><item><title>WikiPage main modified by vzex</title><link>https://sourceforge.net/p/runasdog/home/main/</link><description>&lt;pre&gt;--- v1 
+++ v2 
@@ -1,82 +1,91 @@
-
 [[download_button]]
 [[project_screenshots]]
 
 Author:vzex
 ----
 Mail:&lt;vzex@163.com&gt;
 ----
 
 setup
 =====
 1.Check out svn :svn checkout svn://svn.code.sf.net/p/runasdog/code/trunk runasdog-code
 or download release files above.
 2.cd runasdog-code,and make(be sure you have libevent-1.4 installed)
 3.run test***.sh files for testing.There are two samples,one is remove bash server,another is chatroom.
 4.run telnet 127.0.0.1 3000 for testing.
 
 demos
 ====
 
 remote bash server
 ----
 This is a very simple demo,just execute ./runasdog -p port -f -s -e bash,'-f' will remove '\r' from the input buffer,'-s' will telnet the dog that just redirect the i/o without add other informations(This will explain below).
 
 chatroom server
 ----
 This program is totally written in lua.It shows all of these functions that server can support
 
 function|description
 --------| -----------
 multi-client|look at the pic(chatroom.png)
 broadcast|server send msg to all clients
 server disconnect client directly|look at the pic(chatroom.png)
 not just send one line a time|it is a real web server!you can do anything as a normal server do
 server kick clients when the program is done|nothing to explain
 
 How Does It Work
 ====
 1.dog create a child progress 'cat',cat where run the command from the arguments,like 'bash'.
 2.dog chat with cat by pipe A and pipe B.
 3.cat input stdout and stderr into pipe A,and read from pipe B.
 4.dog start a server,watch for clients join at server port
 5.dog redirect the message from client to pipe B,receive from pipe A,and redirect them to the client.
 
 What is different between '-s' and without?
 ========
 If with '-s',The server runs simple ,just redirect the whole things.But when there are more than one clients join,server must be able to identify who is who there,and which words of the messages got from cat's stdout/stderr should send where. So,the mode without '-s' comes into being.
 In this mode,cat recv buffers as this format:
 
 |
 -|-
 c5:127.0.0.1:1344|c:connected,5:client pipe id,127.0.0.1:1344 is the client address
 r5:7:hello u|r:received,5:client pipe id,7:content len,hello u:real content from client
 d5:|d:disconnected,5:client pipe id
 cat send buff as this format:
 
 |
 -|-
 5:7:abcdefg|5:client pipe id,7:content length,abcdefg:content for send to client
 -5:7:abcdefg|5:client pipe id,-5 means after send this content,server will close the client
 0:7:abcdefg|0:broadcast to all the clients
 
 In lua ,there is a demo to handle this:
 
     local function put(fd,...)
     	local s=table.concat({...},"\t").."\n"
     	local len=string.len(s)
     	local format=string.format("%d:%d:%s",fd,len,s)
     	io.stdout:write(format)
     	io.stdout:flush()
     end
     local function get(line)
-    	local t,fd,other=string.match(line,"([cdr])(%d+):(.*)")
-    	if t then
-    		fd=tonumber(fd)
-    		return t,fd,other
-    	else
-    		return nil,nil,nil
-    	end 
+    	local result=""
+    	local t,fd,count,other
+    	while true do
+    		t,fd,count,other=string.match(line,"([cdr])(%d+):(%d+):(.*)")
+    		if t then
+    			fd=tonumber(fd)
+    			count=tonumber(count)
+    			result=result..string.sub(other,1,count)
+    			line=string.sub(other,count+1,-1)
+    			if line=="" then
+    				break
+    			end
+    		else
+    			break
+    		end 
+    	end
+    	return t,fd,result
     end 
     
     local function onConnect(fd,addr,port)
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vzex</dc:creator><pubDate>Fri, 21 Oct 2011 18:45:33 -0000</pubDate><guid>https://sourceforge.net103840a8223f5f9853264743c7ef0ea7cba0f2b3</guid></item><item><title>WikiPage main modified by vzex</title><link>https://sourceforge.net/p/runasdog/home/main/</link><description>
[[download_button]]
[[project_screenshots]]

Author:vzex
----
Mail:&lt;vzex@163.com&gt;
----

setup
=====
1.Check out svn :svn checkout svn://svn.code.sf.net/p/runasdog/code/trunk runasdog-code
or download release files above.
2.cd runasdog-code,and make(be sure you have libevent-1.4 installed)
3.run test***.sh files for testing.There are two samples,one is remove bash server,another is chatroom.
4.run telnet 127.0.0.1 3000 for testing.

demos
====

remote bash server
----
This is a very simple demo,just execute ./runasdog -p port -f -s -e bash,'-f' will remove '\r' from the input buffer,'-s' will telnet the dog that just redirect the i/o without add other informations(This will explain below).

chatroom server
----
This program is totally written in lua.It shows all of these functions that server can support

function|description
--------| -----------
multi-client|look at the pic(chatroom.png)
broadcast|server send msg to all clients
server disconnect client directly|look at the pic(chatroom.png)
not just send one line a time|it is a real web server!you can do anything as a normal server do
server kick clients when the program is done|nothing to explain

How Does It Work
====
1.dog create a child progress 'cat',cat where run the command from the arguments,like 'bash'.
2.dog chat with cat by pipe A and pipe B.
3.cat input stdout and stderr into pipe A,and read from pipe B.
4.dog start a server,watch for clients join at server port
5.dog redirect the message from client to pipe B,receive from pipe A,and redirect them to the client.

What is different between '-s' and without?
========
If with '-s',The server runs simple ,just redirect the whole things.But when there are more than one clients join,server must be able to identify who is who there,and which words of the messages got from cat's stdout/stderr should send where. So,the mode without '-s' comes into being.
In this mode,cat recv buffers as this format:

|
-|-
c5:127.0.0.1:1344|c:connected,5:client pipe id,127.0.0.1:1344 is the client address
r5:7:hello u|r:received,5:client pipe id,7:content len,hello u:real content from client
d5:|d:disconnected,5:client pipe id
cat send buff as this format:

|
-|-
5:7:abcdefg|5:client pipe id,7:content length,abcdefg:content for send to client
-5:7:abcdefg|5:client pipe id,-5 means after send this content,server will close the client
0:7:abcdefg|0:broadcast to all the clients

In lua ,there is a demo to handle this:

    local function put(fd,...)
    	local s=table.concat({...},"\t").."\n"
    	local len=string.len(s)
    	local format=string.format("%d:%d:%s",fd,len,s)
    	io.stdout:write(format)
    	io.stdout:flush()
    end
    local function get(line)
    	local t,fd,other=string.match(line,"([cdr])(%d+):(.*)")
    	if t then
    		fd=tonumber(fd)
    		return t,fd,other
    	else
    		return nil,nil,nil
    	end 
    end 
    
    local function onConnect(fd,addr,port)
    end
    
    local function onDisConnect(fd)
    end
    local function onRecv(fd,str)
    end 
    for line in io.stdin:lines()do
    	line=line:gsub("\r","")
    	local t,fd,other=get(line)
    	if t then
    		if t=='c' then
    			onConnect(fd,string.match(other,"(.-):(.+)"))
    		elseif t=='d' then
    			onDisConnect(fd)
    		elseif t=='r' then
    			onRecv(fd,other)
    		end 
    	end 
    end</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vzex</dc:creator><pubDate>Fri, 21 Oct 2011 18:39:03 -0000</pubDate><guid>https://sourceforge.net9e29bf730c3e119c3f63a4465141bfc76d364e14</guid></item></channel></rss>