> Could you possibly show a simple server and client script that don't
> work for you? It would probably be easier for us to help if we saw
> that.
sorry, here is my sourcecode. I hide the code for sending and sniffing
network traffic, because it isn't important for my connecting problem.
Thanks for your help !!!
Sender:
-------
require 'xmlrpc/client'
server = XMLRPC::Client.new(destAdd,"/RPC2",20000)
server.call("sniffing.connect", 25000, "192.168.10.10")
Thread.new {
server.call_async("sniffing.start")
}
# Now sending network traffic
# ...
server.call("sniffing.stop")
Receiver:
---------
require 'xmlrpc/server'
class Sniffer
def initialize(port, ip)
@port = port
@ip = ip
end
def start
# Use the pcap library to sniff at port @port from ip @ip
# ...
end
def stop
# Stop the sniffer
# ...
end
end
s = XMLRPC::Server.new(20000, "192.168.10.2")
s.add_handler("sniffing.connect") do |port, ip|
sniffer = Sniffer.new(port, ip)
end
s.add_handler("sniffing.start") do
sniffer.start
end
s.add_handler("sniffing.stop") do
sniffer.stop
end
s.serve
--
Posted via
http://www.ruby-forum.com/.