aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Redon <kevredon@mail.tsaitgaist.info>2015-05-17 17:32:47 +0200
committerKevin Redon <kevredon@mail.tsaitgaist.info>2015-05-17 17:32:47 +0200
commit9255b65952a390c0558521321196ad54ea2db991 (patch)
treeabf1814aa354d3117cc35fafedf3c2754a14da7c
parenta771ba47bb6da1b1249c4b61ecbd06e44b54c474 (diff)
change default to unix socket for simple osmocom_sap usageHEADmaster
-rwxr-xr-xsrc/demo_client.rb4
-rwxr-xr-xsrc/demo_server.rb8
-rw-r--r--src/simos_server.rb2
3 files changed, 9 insertions, 5 deletions
diff --git a/src/demo_client.rb b/src/demo_client.rb
index c8c8911..947833f 100755
--- a/src/demo_client.rb
+++ b/src/demo_client.rb
@@ -31,13 +31,13 @@ require_relative 'copy_client'
# client use (demo,info,copy)
@type = "demo"
# which IO to use (tcp,unix,bt)
-@socket = "tcp"
+@socket = "unix"
# tcp port
@port = 1337
# tcp host
@host = "localhost"
# unix socket
-@unix = "/tmp/sap.socket"
+@unix = "/tmp/osmocom_sap"
# file were to save the copy
@file = "sim.xml"
# bluetooth rfcomm serial port
diff --git a/src/demo_server.rb b/src/demo_server.rb
index a5c49db..e89b69d 100755
--- a/src/demo_server.rb
+++ b/src/demo_server.rb
@@ -27,11 +27,11 @@ Copyright (C) 2011 Kevin "tsaitgaist" Redon kevredon@mail.tsaitgaist.info
# the server to use (pcsc,sim)
@type = "pcsc"
# which IO to use (tcp,unix)
-@socket = "tcp"
+@socket = "unix"
# tcp port
@port = 1337
# unix socket
-@unix = "/tmp/sap.socket"
+@unix = "/tmp/osmocom_sap"
# sim file
@file = "sim.xml"
# the verbosity (from common)
@@ -99,6 +99,10 @@ when "tcp"
socket = TCPServer.new("0.0.0.0",@port)
when "unix"
require 'socket'
+ if File.exists?(@unix)
+ puts 'Previous socket exists, deleting it...'
+ File.delete(@unix)
+ end
socket = UNIXServer.new(@unix)
else
raise "please defined which socket to use"
diff --git a/src/simos_server.rb b/src/simos_server.rb
index 07e9ddd..3c7a52a 100644
--- a/src/simos_server.rb
+++ b/src/simos_server.rb
@@ -47,7 +47,7 @@ class SIMServer < Server
status = create_message("STATUS_IND",[[0x08,[0x02]]])
send(status)
sleep 1
- redo
+ retry
end
# select MF