As part of a TDD (test driven development) project I want a simple OSX service/server that simply forwards data between two clients. The purpose is to enable communication between one piece of code running in iOS (being tested) and another running in OS X.
I think I need both parties to connect to the server for the duration of the test, which points at TCP
There are lots of examples for creating simple clients using NSStream, but have failed to find what creates the Server side.
I would have thought it would be normal for this forwarding software to be a client of the final server, rather than both the other pieces of code being a client to it (as it's both counter-intuitive and somewhat difficult to acheive):
iOS App -> Forwarding Server -> OSX Server
You can achieve this using netcat (which is installed by default on OSX), simply with:
$ nc -l -p local-port -c "nc osx-host osx-port"
(see below)
and the iOS app simply needs to connect to local-port on whatever machine this forwarding server is running on.
EDIT When I actually tested my answer I found that the netcat supplied with OSX cannot support port forwarding, and the answer I supplied only works with the Linux version (I believe there is a BSD-rewrite which OSX uses).
Anyway, this can be achieved if you are happy to install macports and use socat. Here's a working example that redirects port 8888 to www.google.com:80:
$ sudo port install socat
$ socat TCP-LISTEN:8888,fork TCP:www.google.com:80
If you then connect to http://localhost:8888 within your browser, this will hit Google.
Port Forwarding In Windows for iOS .
1. Install Python 2.7 on windows system
2. Connect your iPhone to windows system
3. Download USB MXD1.0 and put it in C Drive
4. Run Command Prompt : OpenC:\usbmuxd-1.0.8\python-client in cmd
5. Run **\Python27\python.exe tcprelay.py -t local port:remote Port**
Eg :**\Python27\python.exe tcprelay.py -t 9892:9892**
Related
I am trying to remotely access a Jetson Nano from my mac. So far I have done the following:
I installed microsoft Remote Desktop on my mac
I connected the nano with my mac through the Micro-usb Port
In network I could see the connection "linux for Tegra" where my nano would be 192.168.55.1
With this I still cannot remote access the nano
So I open a terminal and typed
>ssh username#192.168.55.1
and I could access the nano terminal.
So I think now, I have to do
>sudo apt install xrdp
in order to be able to remotely access the GUI.
However, the nano does not have internet connection.
Is there a way that it can use the internet connection of my mac to do this?
(I am reading a tutorial on Rasppi with windows and apparently this is possible)
One of the approaches is to install X server for mac and then use ssh -Y username#192.168.55.1. You will get the command line shell first but you can type in commands like gedit - they windows will show up on the host.
192.168.55.1 is the same network as any other. All tools supposed to work over TCP/IP should work with it as well.
USB is a Serial connection by default.
On windows use a putty based tool.
For example start with MobaXterm > New session > Serial #11500
Login
Password
It won't forward internet by default.
Best simple way is to plug in your phone as USB network sharing and plug in to the laptop via micro-USB.
For Linux, Ubuntu, use a serial ("COM" related stuff) tool.
If you want to do ssh through USB it will require custom editing of networking file.
By default Nano is using a bridge called L4TBRO on 192.168.55.1, laptop is client in .100.
DNS server is on Nano's side.
You would have to create a new interface but using your laptop as DCHP and DNS servers.
Note that usb can power the Jetson Nano for continuous execution on a recent laptop. Some recommends not to and it may crash if you run a compilation on all cores. (if it crashes, just disable 2 cores via nvpmodel -m 1)
I found a strange thing when using ssh -X to connect to two servers.
Ubuntu16.04 is installed on one server, while Ubuntu 18.04 is installed on the other. I upload a simple shell script as following to both servers:
#!/bin/bash
tab=" --tab"
options=()
cmds[1]="echo Banana"
cmds[2]="echo Cat"
for i in 1 2; do
options+=($tab -e "bash -c '${cmds[i]} ; bash'" )
done
gnome-terminal "${options[#]}"
exit 0
You know this script will open a new terminal window on server with two tabs. One tab will print "Banana", and the other tab will print "Cat".
Then I using ssh -X to remotely login into the first server (Ubuntu 16.04) and execute this script on server, I got a new terminal opened with two tabs on my pc. That is I saw the remote terminal GUI of server on my own computer. However, if I repeated these steps on the second server(Ubuntu18.04), I will got nothing to show on my computer.
The I execute commandgedit on the ssh login terminal when using ssh -X to login into both servers, I could see the GUI on my computer for both the cases.
I guess Ubuntu 18.04 cannot transport terminal's GUI through ssh -X to my pc. I was very confused about this. Could you please to explain the reason? And BTW, how can I see terminal's GUI of server in this case? Thanks a lot!
ssh -X doesn't transport a terminal. It tunnels a X11 connection.
X11 in its core is a network based display protocol. The programs (X clients) connect to a X server (a program running on your local machine) and instruct it to create windows and draw stuff to it. There is no graphical rendition of any kind anywhere else than the X server!
ssh -X does not operate like Windows Remote Desktop, where there is an actual graphics environment running on the remote machine. Hence if you create two separate ssh -X connections (maybe even from different machines), these connections are completely independent from each other. Hence you cannot use ssh -X to connect with a preexisting X session!
What you want is either Xvnc or Xpra, where the graphics environment is actually run on the remote machine, and only the output is transferred to your local machine.
I want to run my application (based on OPEN API) on a server on which Bloomberg Terminal is not installed. But I have to pass by a Bloomberg server.
Look at "Figure 7-2: Server API: Server Mode: Authorization by IP Address" on page 80 of "blpapi-developers-guide.pdf".
Please let know how this can be done.
Or how setup EMRS in order to allow an application to be given entitlements and services to consume?
Thank you.
IMPORTANT: This method is not compatible with Bloomberg licence agreement. Use it only for debug purposes.
Download PasPort application from here and install it. PassPort is a simple port forwarding utility. The program runs as an NT Service. It is easily manageable with a simple Windows GUI.
For example your computer with Bloomberg terminal has ip 192.168.8.40, then you need to setup PassPort application as following:
Don't forget to add a rule to the firewall in Windows:
Now you can access terminal from any computer on the local network. Furthermore, you can setup access to terminal behind a firewall.
For example you can run on computer with ip 192.168.8.41 the such command:
java -jar SimpleFieldInfoExample-3.6.1-0.jar -ip 192.168.8.40 -p 8194
And it is working now!
Of course you also need to run bbcomm.exe on Bloomberg terminal using Start menu:
It is possible to activate bbcomm without any window using command:
java -jar SimpleFieldInfoExample-3.6.1-0.jar -ip localhost -p 8194
Or you can launch the "Bloomberg API DEMO" application.
There is a simpler way to pass a port:
netsh interface portproxy add v4tov4 listenport=8194 listenaddress=192.168.0.101 connectport=8194 connectaddress=localhost
I'm using NSURLConnection to access a web service (on a .local host). When I access the host by hostname, I'm seeing a delay of 5+ seconds, but when I access it by IP, the connection completes almost instantly.
Running the app on an actual iPhone, instead of the simulator, does not show any delays at all (testing was done on the same network connection). So this seems to be a problem specific to the iOS Simulator or OS X.
I'm able to simulate the problem using the following terminal commands:
nslookup webservice.myhost.local (which is fast)
dscacheutil -q host -a name webservice.myhost.local (shows the delay)
When analyzing the network traffic using Wireshark of the dscacheutil command, I'm seeing several Standard query AAAA requests which are marked red and get an empty response. Once these are done, I see a Standard query A request which has a response containing the correct IP address. The AAAA requests take up about 5 seconds, which would explain the delay.
Does the web service perhaps have IPv6 enabled and you can't use that from the simulator?
I see this on OSX for example when running a local IPv4 only DNS service - if I run dig #localhost is hangs for some seconds until the initial IPv6 connection times out, and then it tries IPv4.
This answer solved the problem for me. (Create an IPv6 ::1 loopback entry to go along with each 127.0.0.1.)
For anyone else who stumbles across this issue... I myself had to disable IPv6 on my machine to avoid the hang in the simulator while IPv6 fails. I did so following these instructions: https://discussions.apple.com/message/18097613#18097613
Which were to:
"To disable IPv6 in OS X Lion, you will need to use the Terminal.
Applications > Utilities > Terminal
To determine what are all of your Mac's network interfaces are, issue the following command: networksetup -listallnetworkservices
To disable IPv6 for wireless, issue the following command: networksetup -setv6off Wi-Fi;
To disable IPv6 for Ethernet, issue the following command: networksetup -setv6off Ethernet
To re-enable IPv6, use -setv6automatic instead"
We wrote a small prototype web app using Pharo and Seaside and we want to now demonstrate to the suits that the app can be deployed into our standard Linux build. We use a mix of CentOS, Ubuntu Server and Gentoo which are run headless since most of our apps are JAVA/Apache based. Only port 80 and 443 are open to the outside world.
What are your experiences when hosting Seaside/Smalltalk server side apps?
it runs great, btw you can get free hosting for your seaside app at:
http://www.seasidehosting.st/
for more power you'd need your own server of course...
some benchmarks here:
http://gemstonesoup.wordpress.com/2007/10/19/scaling-seaside-with-gemstones/
The Seaside Book has a chapter on deployment. It describes how I typically deploy a Seaside application.
I just use a ssh tunnel to get the X display on my local machine. I'm using slicehost (US) from the Netherlands, so I have a ping time of 135 ms. That's not that nice, but ok.
Next step will be Lukas Renggli's remote frame buffer package to use a vnc viewer.
Let's see what Miguel Cobá had to say about it on it on the Gemstone mailing list:
If you have already installed a RFB in your machine then use it.
If you have RFB installed in your image and it is accesible from your
client machine, use it
But, both of them are unencrypted. If you want to encrypted you must
setup a tunnel (maybe with ssh or maybe TLS).
I think that that is redundant because you must use a tunnel and then
the RFB. So what I do, in linux is to install the minimal X libraries
and then forward the X session to my local machine.
In the server (Debian/Ubuntu instructions):
aptitude update
aptitude install xbase-clients
aptitude install xtightvncviewer
Test it from the client machine:
ssh -X remote_server
squeakvm gemtools.image &
This will start the squeakvm process on the server, but all the graphics
will be shown on the local machine (the Xserver for this particular
scenario).
Also, if you install RFB on some of your images and start them headless,
you can use xtightvncviewer to connect to inside the image through the
RFB server.
ssh -X remote_server
xtightvncviewer localhost:0 &
this will run the xtightvncviewer on the remote server but, again, will
show on your local machine. Supposing you have your image in the remote
server running RFB in the first display.
Which is the advantage:
- You don't have to open ports for RFB on the remote server
- You transmit everything encrypted through ssh
- You only run the commands on demand in the remote server. You don't
have to have VNC running always.
- You can configure your RFB in the image to accept only localhost
connections and not from everywhere.
Martin McClure adviced me to take a look at NoMachines NX (less chatty X),
but that's still on my todo list.
For another set of deployment instructions, take a look at Miguels blog
The blogosphere's been talking about this issue recently.
Doug Putnam wrote up his experiences in installing Seaside (on Pharo) on his Slicehost slice, working off James Robertson's writeup (which uses VisualWorks, I suppose?).