/'\_/`\ | | | (_) | | | | | (_) (_)
|\ /| ( \ / ) \ (_) / \ / ) ( | | \_/
## ## ## ## ## ## ## ## #####
_______ ( ___ ) | ( ) | | | | | | | | | | | | | | (___) | (_______)
#### ## # ## ##### ## ## ####
IMPORTANT: enter the case-INsensitive alphabetic (no numbers) code AND WRITE SOME SHORT summary of changes (below) if you are saving changes. (not required for previewing changes). Wiki-spamming is not tolerated, will be removed, so it does NOT even show up in history. Spammers go away now. Visit Preferences to set your user name Summary of change: '''Useful socat options and recipies''' (to connect to device remotely, possibly behind restrictive firewall) Traditional way to make a serial relay that '''TCP LISTENS on port 9001''' is via ser2net : <code> echo '9001:raw:600:/dev/ttyUSB0:19200 8DATABITS NONE 1STOPBIT'>>/etc/ser2net.conf </code> For some reason the ser2net + socat at the ECU side seem more reliable than just socat (maybe we have not fully mastered socat yet ?) TODO: socat equivalent (the order of descriptors might matter; tcp-l or the serial device should be first ? So that socat only opens the serial device when accepting incoming connectiong from TCP remote peer). See OverTCPWireless ---- '''Poor man's "turn-server"''' <code> # On a public IP: export SOCAT_DEFAULT_LISTEN_IP=.... (may or may not be needed) socat tcp4-listen:9907,reuseaddr tcp4-listen:9906 # And on ser2net (assuming ser2net listens on 9001): socat tcp:localhost:9001 tcp:public-ip.net:9907,forever,interval=10,fork </code> * Obviuosly since socat connects ser2net and 9907, so VT connect to public-ip.net:9906 * Expect runtime data rate of 5..8Hz (not 15..20Hz as locally). ---- ser2net is very useful when connecting over LAN (or via WAN when one has firewall administration passwd and knowledge ). However, very '''often people do NOT have firewall administration passwd''' => they cannot connect to their devices over WAN. In that case the devices can be set up to '''CONNECT''' to some relay (similar to a "turn server") that listens on some known public address. Since socat can open the serial device (without ser2net), '''perhaps ser2net is not needed AT ALL. Socat might be just enough on orangepi/raspi''' [https://stackoverflow.com/questions/9341254/reconnect-socat-connection-after-network-failure socat example] '''Socat''' * mss=1448 (1452 should mostly work, but probably no disadvantage of 1448 or 1444) ** mss option was needed for some telco in London that used mtu=1492 ( common in ADSL pppoe or similar) So an example of '''running socat to tcp-connect''' (not listen!): <code> while [ ! -e /dev/shm/STOP ]; do socat file:/dev/ttyUSB0,b19200,raw,echo=0 tcp:svn.x-dsl.hu:8809,mss=1444,forever,interval=10,fork ; sleep 1; done </code> (run from terminal, socat -v option is your friend; only run from rc.local after it works as expected - even in case of network disconnects). Point your VemsTune to svn.x-dsl.hu:8808 and it will connect to the serial port opened by socat if all goes well * note: 8808 (2N=even) and 8809 (2N+1: odd) are 2 ports of the SAME publically reachable dragon "relay" server. * While it is experimental, it worked every time I tested. (if many users want to use it simultaneously, more server ports will be needed). Optional: Add document to category: Wiki formatting: * is Bullet list ** Bullet list subentry ... '''Bold''', ---- is horizontal ruler, <code> preformatted text... </code> See wiki editing HELP for tables and other formatting tips and tricks.