connection,nat , So many persistent connections to the server. Is that the right way?


So many persistent connections to the server. Is that the right way?

Question:

Tag: connection,nat

I would like to understand networking services with a large user base a bit better so that I know how to approach a project I am busy with.

The following statements that I make may be incorrect but they still lead to the question that I want to ask...

Please consider Skype and TeamViewer clients. It seems that both keep persistent network connections open to their respective servers. They use these persistent connections to initiate additional connections. Some of these connections are created by means of Hole Punching if the clients are behind NATs. They are then used for direct Peer-to-Peer communications.

Now according to http://expandedramblings.com/index.php/skype-statistics/ there are 300 million users using Skype and 4.9 million daily active users. I would assume that most of that 4.9 million users will most probably have their client apps running most of the day. That is a lot of connections to the Skype servers that are open at any given time.

So to my question; Is this feasible or at least acceptable? I mean, wouldn't it be better to not have a network connection open while idle and aspecially when there are so many connections open to the servers at once? The only reason I can think is that it would be the only way to properly do Hole Punching. Techically, how is this achieved on the server side?


Answer:

Is this feasible or at least acceptable?

Feasible it certainly is, you mention already two popular apps that do it, so it is very doable in practice.

As for acceptable, to start no internet authority (e.g. IETF) has ever said it is unacceptable to have long-lived connections even with low traffic.

Furthermore, the only components for which this matters are network elements that keep connection/flow state. These are for sure the endpoints and so-called middleboxes like NAT and firewalls. For the client this is only one connection, the server is usually fine tuned by the application developers (who made this choice) themselves, so for these it is acceptable. For middleboxes it's simple: they have no choice, they're designed to just work with all kind of flows, including long-lived persistent connections.

I mean, wouldn't it be better to not have a network connection open while idle and aspecially when there are so many connections open to the servers at once?

Not at all. First of all, that could be 'much' slower as you'd need to set up a full connection before each control-plane call. This is especially noticeable if your RTT is big or if the servers do some complicated connection proxying/redirection for load-balancing/localization purposes.

Next to that this would historically make incoming calls difficult for a huge amount of users. Many ISP's block/blocked unknown incoming connections from the internet by means of a firewall. Similar, if you are behind a NAT device that does not support UPnP or PCP you can't open a port to listen on for your public IP address. So you need it even aside from hole-punching.

The only reason I can think is that it would be the only way to properly do Hole Punching. Techically, how is this achieved on the server side?

Technically you can't do proper hole-punching as soon as the NAT devices maintain a full <src-ip,src-port,dest-ip,dest-port,protocol> (classical 5-tuple) flow match. Then the best you can do with 'hole punching' is set up a proxy between peers.

What hole-punching relies on is that the NAT flow lookup is only looking at <src-ip,src-port,protocol> upstream and <dest-ip,dest-port,protocol> downstream to do the translation. In that case both clients just set up a connection to the server, their ip and port gets translated and the server passes this to the other client. The other client can now start sending packets to that translated <ip,port> combination which should work because NAT ignores the server's ip/port. But even if the particular NAT would work like this, some security device (e.g. stateful firewall) might detect session hi-jacking and drop this anyway.

Nowadays you rather use UPnP to open up a port to listen on your public IP which is much easier if supported.


Related:


Android, Bluemix Error 401 : You are not authorized


android,connection,database-connection,http-status-code-401,bluemix
I downloaded the sdk from here, created an application but when i run the app the logcat notifies: Error 401, Failure: You are not authorized. I tested the Bluemix app with the sample code you can find here, obviously switching the default parameters with my app's ones....

Data in Excel with OLEDB connection from access don't update when use LIKE operator


excel,ms-access,connection,ms-office,oledb
When I use LIKE operator in a Query in Access and I create a OLEDB connection in Excel to import this data to Excel, the data don't update even after change the query with another filter. Is like if I had not changed the query with the new filter. I...

Arduino 2006 how to connect to my laptop?


arduino,connection
I have borrowed an Arduino BT-V06 (analogue) from my college IT storage department. At home I am trying to do some research on this for subsequent work I am going to perform with this Arduino later on. As this model is a 2006 version; my question is, how do I...

Reasons why resources in c3p0 cannot get checked out?


java,connection,stack-overflow,connection-pooling,c3p0
So I was looking into the c3p0 API to debug one of our production issues which was resulting in a stack overflow error while checking out a connection. I found below comments in BasicResourcePool class's checkoutResource method: /* * This function recursively calls itself... under nonpathological * situations, it shouldn't...

Customize error messages in the database with connection


php,connection
I'm new to PHP, and wanted to make my connection back a custom message without making show those warnings. But when I add the check nothing happens, my complete code below. <?php class Connect { private $Connect; public function Connect() { $this->Connection(); if(connection_aborted() == TRUE) { $this->Connection(); } } public...

LINQ connection in app.config


.net,linq,connection
I have been reading how to store the connection string for a dbml in the app.config whereby I would create a partial class with the same name as the existing one for the dbml. One thing I haven't seen though, should this be created within the dbml's designer.cs file? thanks...

If app A listens to the same private port previously used by app B, will app A get app B's public port number?


udp,client-server,port,firewall,nat
If one application listens to the same private port number previously used by another application on that computer, will the more recent app get the same public port number as the less recent app? Application A and Application B both use non-multicast UDP. They both run on a computer that...

sharepoint rest service 401 not found


java,url,sharepoint,connection
Getting unauthorize execption while connecting to share point rest web service: URL myURL = new URL("http://test:2014/PWA/_api/ProjectData/Projects"); URLConnection uc = myURL.openConnection(); HttpURLConnection myURLConnection = (HttpURLConnection)myURL.openConnection(); String userCredentials = "admin:pasword"; String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary("password".getBytes()); uc.setRequestProperty ("Authorization", basicAuth); InputStream in = uc.getInputStream(); Getting following errors while...

How to close incoming ssh connection listed through who?


linux,ssh,connection,close
Using command 'who' we can check who is currently logged in to our computer for example as below: [email protected]:~$ who mark :0 2015-04-19 11:14 (:0) mark pts/25 2015-05-13 18:14 (:0) mark pts/24 2015-05-13 18:26 (externalpc_via_ssh) We can see that someone is logged in from other computer named 'externalpc_via_ssh'. Of course...

OData not working behind router with port address translation (port forwarding)


odata,asp.net-web-api2,firewall,nat,portforwarding
I have two applications hosted on different computers : An OData web site APP1 on PC1 A basic MVC application APP2 on PC2 My router (my.server.com) is configured to forward following request : *:10080 to PC1:80 *:20080 to PC2:80 I used Microsoft.OData.Client library to generate OData context and use it...

Open Connection and Recordset objects to use SQL for sheet to sheet data movement


excel-vba,connection,adodb,recordset
I am trying to open Connection and Recordset to use SQL to move data between worksheets within the open workbook. To be clear all the data source sheets are open in the current workbook that I am trying to copy data from and to a different worksheet within the same...

Node.js : How to check if mongojs connected successfully?


javascript,node.js,mongodb,connection,mongojs
Im making a server and need some way to be identified if mongojs connected successfully to the mongodb database when i call the function : mongojs.connect(connectionString, collections); Is there a callback or an event listener i could use?...

Access webserver that's behind a symmetric NAT


linux,nat,symmetric
How can I access a webserver if both the webserver and the client are behind symmetric NATs? I thought about using a second server as an HTTP proxy/relay but I'm not sure if this is possible.

Prestashop custom php file with query


php,include,connection,prestashop,require
I am new to prestashop and I have made a custom php file which is called by ajax and has SQL queries. The problem is that this file doesn't have a connection. What should I include or require in it to achieve it?

trying to connect to mysql database


java,mysql,jdbc,connection
I'm trying to connect to my database. I added the MySQL connector driver jar by creating a folder called lib Putting the jar inside lib Right Clicking on the project >> Properties >> build path >> (going inside the libraries tab) >> adding jar my code looks like this: public...

Pass vijava ServiceInstance via rabbitmq or another task queue


connection,vmware,vmware-sdk
I'm trying to create a system where a master will create a connection to vcenter and passes the serviceinstance object to a bunch of performance collectors that can then do their work and exit. My question is what would be the best method to share the SI object? I was...

MySQL connexion over SSH


mysql,ssh,connection
I'm getting an error trying to connect to a distant MySQL server from my local MySQL client. (server is running Debian and client runs OSX) I can manage to ssh to the server ... local$ ssh [email protected] (note: i'm using ssh public key so i don't enter any password) ......

host parameter in mysqli_connect() for online website


php,mysqli,connection
I'm a beginner in PHP development. In my local station, I use xampp to host my project and use localhost to set up my host parameter. But now that I have uploaded my project in a host server, it gives an error: failed to connect to my sql: Access denied...

JSch Algorithm negotiation fail


java,connection,sftp,jsch
I try to connect SFTP server by Java. I got an error. com.jcraft.jsch.JSchException: Algorithm negotiation fail Here is the POM: <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> <version>0.1.53</version> </dependency> Here is the log: INFO: Connecting to **"FTP ADRESS"** port 22 INFO: Connection established INFO: Remote version string: SSH-2.0-Maverick_SSHD INFO: Local version string: SSH-2.0-JSCH-0.1.53 INFO:...

Problems with connecting Hibernate to two databases


java,spring,hibernate,connection,multiple-databases
I'm having problems with getting my Java Spring + Hibernate program work with two different databases from two different servers. I have two DAO-s and two DAO implementation files for different databases. Implementation files looks like this: ErpDaoImplementation: @Repository("erpDao") @Transactional(value="txManager2") public class ErpDaoImplementation implements ErpDao { @Autowired private final SessionFactory...

Does main() get paused during signal handling?


c,database,connection,posix,daemon
I'm developing a POSIX daemon which reads from a database from time to time. I'd like to close the connection when SIGTERM arrives (e.g. when the system shuts down). When the signal handler is called, is the main() paused until the handler finishes its job? If so and the handler...

Netty: Using a channel defined in the anymous inner class within another method


java,connection,netty,channel,anonymous-inner-class
I have implemented a server-client connection in Netty, I can send and receive data between the two connections. public void start() { // Start the interface bossGroup = new NioEventLoopGroup(); workerGroup = new NioEventLoopGroup(); try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .childHandler(new ChannelInitializer<SocketChannel>() { @Override public void...

Hibernate+PostgreSQL “Too Many Connections” error


java,hibernate,postgresql,connection,pool
I've app, which use the database in multiple concurrent sessions (over 1000). In Postgres the max connections available is set to 100 by default and i haven't change this. Hibernate has max connection pool size is 20, but the app seems to be ignored this and throws "Too many connections"...

C# Simple SSH Connection And Send Command


c#,ssh,connection,sbt
this is the code i'm using SshClient cSSH = new SshClient("192.168.10.144", 22, "root", "pacaritambo"); cSSH.Connect(); SshCommand x = cSSH.RunCommand("exec \"/var/lib/asterisk/bin/retrieve_conf\""); cSSH.Disconnect(); cSSH.Dispose(); but i want to send command from a textbox so I've tried this SshCommand x = cSSH.RunCommand(textbox3.Text); but didn't work basically i want textbox3.Text as a ssh command....

Connection was not closed. Connection's current state is open


c#,connection
It gives the error connection was not closed. Connection's current state is open. Please help out with the code. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\vicky\Desktop\Gym management system\Fitness_club\vicky.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"); try { con.Open(); SqlCommand cmd = new SqlCommand("Select * FROM [plan] where plantype='"...

Why my access from my mobile to my computer network doesn't work?


android,mobile,connection
I have a problem and it is that, yesterday, I could access from my mobile phone to my computer network but today it doesn't work. Why it could be? What I have ready: I have running my server(XAMPP) I'm connect via WIFI to the same network. My mobile phone it's...

C# send data to remote server


c#,connection
I have a client and server in C# and currently they are only able to communicate under a local network. How do I create a remote connection? Currently I have started looking at web services and getting to know what it can do. I have also heard several advice such...

Laravel / Eloquent : change connection and get all


laravel,connection,eloquent
I have 2 database connections defined: sqlite: a connection to a specific sqlite DB, mysql: a classic mysql DB. and the following Model class: class BoPerson extends \Illuminate\Database\Eloquent\Model { protected $table = 'persons'; protected $connection = 'mysql'; public $timestamps = false; } This works: $persons = BoPerson::all(); But this doesn't...

OSX internet via TimeCapsule - wireless works, wired doesnt


osx,network-programming,connection
I have a strange problem. My ISP delivers internet over cable. There is a cable modem/router (F-connect in) at the entry-point and from there a wired connection to my TimeCapsule. Everything is fine. I have a OSX laptop and a OSX Mac mini. On both I want to connect to...

How to avoid program freezing when connecting to server


python,connection,whois,pywhois
I have a little script which filters those domain names which are not registred yet. I use pywhois module. The problem is that it suddenly freeze and do nothing after several (sometimes hundreds) of requests. I think it is not a ban because I can run the program right after...

ServieConnection Not Working At All Android


android,service,connection
Good Day.I have the simplest scenario which could ever be!I have simple service connection which taken from google in app purchases example and this is my own code public class MainActivity extends Activity { IInAppBillingService mService; ServiceConnection mServiceConn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mServiceConn = new ServiceConnection()...

TcpClient still connected after server closed connection. Why?


c#,tcp,connection,tcpclient
I have a TCP server running serving TCP clients - crazy, I know. Now I have a behavior that is not clear to me and maybe someone could help me understanding it. [Test] [TestCase(2, 1)] // first scenario: Okay! [TestCase(1, 1)] // second scenario: Huh? public void NotifyClientAboutError(int clientSendBytes, int...

Django on AWS EC2 unable to connect, regular Python connects


python,django,amazon-web-services,amazon-ec2,connection
I am trying to run the development version of Django from the Github dev code. The code is running on an AWS EC2 instance, and I'm running Firefox on my local desktop (Kubuntu Linux). When I try to connect I get this error: Unable to connect Firefox can't establish a...

Cannot establish connection to application listening on 0.0.0.0:8443


connection,netstat
I have an application that is listening on 0.0.0.0:8443 (local address). "netstat -ant" output: proto||Recv-Q||Send-Q||Local Address||Foreign Address||State tcp||0||0||0.0.0.0:22||0.0.0.0:||LISTEN tcp||0||0||0.0.0.0:8443||0.0.0.0:||LISTEN These are the only two ports that are listening. When i telnet localhost port 22 and 8443, both are able to connect. But when i telnet from another computer on the...

R readHTMLTable failed to load external entity [duplicate]


xml,r,connection
This question already has an answer here: R Error using readHTMLTable 2 answers When I run the line on my laptop, table500 <- readHTMLTable('http://en.wikipedia.org/wiki/List_of_S%26P_500_companies')[[1]] it gets the data. When I run it on my desktop, I receive the error Error: failed to load external entity "http://en.wikipedia.org/wiki/List_of_S%26P_500_companies". So I'm guessing...

Entity Framework connection factory not working


c#,entity-framework,connection,entity-framework-6,sqlanywhere
I use entity framework 6 and try to overwrite the connection string factory. I've written the following connection factory: internal class MyDBConnectionFactory : IDbConnectionFactory { public System.Data.Common.DbConnection CreateConnection(string nameOrConnectionString) { SAConnection connection = new SAConnection(ConnectionManager.GetConnectionString(nameOrConnectionString ?? "Default")); return connection; } } Than i have written my own configuration class: public...

connecting my vb.net app to MySQL database


mysql,vb.net,connection
guys i'm trying to develop an app (using vb.net & sql database) ,managing my database using PhpMyAdmin ,so the problem is , when executing my app , it shows nothing :/ , i don't know if the problem is a bad password , but even so , it should be...

For how long a router keeps records in the NAT and can they be reused forwarding requests from other hosts?


udp,rewrite,router,packet,nat
There is an answer explaining in simple terms how a router works translating requests from the local network to outside and back (http://superuser.com/questions/105838/how-does-router-know-where-to-forward-packet) what is not clear - for how long a record in the NAT is kept? For example, if I send a UDP request to 25.34.11.56:3874 and my...

How to monitor the Internet connectivity on two PCs simultaneously?


python,http,cron,connection,monitor
I have two PCs and I want to monitor the Internet connectivity in both of them and make it available in a page as to whether they're currently online and running. How can I do that? I'm thinking of a cron job that gets executed every minute that sends a...

Identification of clients


c#,connection,tcpclient
I have a server to which multiple clients are connected. I want to identify what is happening with each client. For this, I need some kind of identification for a particular client. TcpClient tcpClient = (TcpClient)client; logger.DebugFormat("Connection obtained with a client {0} {1} {2} ", client.Connected, client.Client.LocalEndPoint,client.Client.RemoteEndPoint); But I need...

Java “Connection” Class does not connect to the DB


java,mysql,netbeans,connection,database-connection
I'm trying to connect my DB with a Java Application i'm creating. What I got so far: public class DBConnect { public void DBConnect() { try { DBConnect DBConnect = null; String url = "jdbc:mysql://localhost:3306/ähs_system"; String uName = "**"; String uPass = "**"; // Connection conn = DriverManager.getConnection(url, uName, uPass);...

Can a Chrome extension get information about a connection?


google-chrome,google-chrome-extension,https,connection
I want my Chrome extension to collect information about how the current browser tab negotiated its secure connection. In particular, I want to know the protocol and the cypher/auth & key exchange mechanisms used in the HTTPS connection: SSL3? TLS 1.2? And those ugly strings like AES_128_GCM or CHACHA20_POLY1305, ECDHE_RSA...

How to block interconnection of devices in LAN network?


connection,ping,router,lan
I want to block interconnections of devices in my network i.e in LAN one device should not be able to ping another device. I think for this I have to configure my router but i dont know the details.

Geektool internet on/of image


image,osx,connection,status,geektool
Trying to display an image when I am connected to the internet and another when I am not, I managed to come up with this 2 geeklet system: 1 shell: if curl -f -s http://google.com > /dev/null ; then cp /Users/mike/Documents/net.png /tmp/connstatus.png ; /Users/mike/Documents/noNet.png /tmp/connstatus.png ; fi ; 2 Image:...

NettyIO disconnect Client from Server


java,connection,handler,netty,channel
How can I disconnect a netty client from the server so it executes the handerRemoved method on the server side and completely stops running? I tried using group.shutDownGraceFully() but the client still keeps connected to the server. Is there any method I am missing? I also noticed when I try...

Could not connect to database postgres: FATAL: role“_postgres” does not exist


osx,postgresql,connection,psql
Working on OS X 10.10, installed postgreSQL and PostGIS from here, psql vers 9.3.5. I am having a hard time getting postgreSQL running. I installed the packages as admin on my computer. My username is christoph The only way I can log in is via: $ psql -U postgres I...

How can others connect on my AHKsocket winsock server? External IP?


connection,ip,autohotkey,tcp-ip,winsock2
Using AHKsock (AutoHotkey), I built a minimalistic client-server system with AHKsock_Connect, AHKsock_Send and AHKsock_Listen on both sides to communicate with each other. It works and I can send messages back and forth, if I connect to the server using localhost. But I want the server to be accessible from everywhere....

Fetch Android files using FTP and Python


android,python,ftp,connection,fetch
I'm currently struggling with some difficulties to fetch android files using a FTP server and Python. I installed on my Android device a application to act as an FTP server. I tested on the Windows explorer and was able to view and interact with the ftp data. Now, I'm trying...

connectionString outside SQL server with App.config file


c#,sql-server,connection,connection-string,app-config
I have a console application and in the App.config I need to add a connectionString to another SQL server that is in the same network. If I try the connectionString to a local server by only passing the Server='localhost' its worked but I cannot make it work for an outside...

how do I specify my user name in network to connect to an oracle data base


java,oracle,connection,username
I installed Oracle on computer1 and I create a data base named DataBase1 and a user named User1 identified by password1, the ip adress of that computer is 1.1.1.1 I connected that computer to a second one (computer2) that the ip address is 1.1.1.2. I created a java program who...