Using TcpClient with VPN connection - tcpclient

I'm writing a proprietary Telnet class and use TcpClient. Everything works well in the console and data transmission generates no issue with devices (sockets) in the same IP group. I tested also a new WPF project using this class again and the functionality is given as well.
Today I tried the identical WPF project again using a VPN connection, but TcpClient generates an exception. At the beginning it looks like the first console version was still working as expected, but during several tests, I noticed that even the console version generates sporadically an exception.
I checked the VPN connection and the availability of the IP/port. Everything should be fine. I used Wireshark (I’m not familiar with) and it looks like in the case, the connection fails, there is no request to the IP in the VPN network.
After a restart of the computer, connecting seems to work several times, but after a view tests, it ends with an exception again.
For sure, I have to handle the exception but first of all, I try to solve this connection issue.
Did anybody have experience using TcpClient and VPN? I read, that it’s sometimes recommended to use a bind, but till now, I don't have a solution.
This is a link to the console version I used as a starting point.

Related

How do I resolve an "Arg_NullReferenceException" error when trying to connect through CheckPoint VPN?

I use CheckPoint VPN to log in to my place of work's servers to work remotely. The VPN has been working (mostly) fine all year, and I haven't changed any of the settings, but this morning, when I tried to log in, it's giving me the "Arg_NullReferenceException." I can't seem to find anything on this particular error on google.
I have tried restarting my computer, because it's not the first issue I've had with CheckPoint VPN (though it is the first time I've seen that error message), and a restart usually resolves whatever issue I'm having. I've also tried creating a new connection with the same settings, but I'm getting the same error with that one, too.
I'm not entirely sure what other information I would need to provide. I'm also not sure if it's a problem on my end, or on the company servers. I have already emailed tech support, but I thought I should be thorough.
This is a known issue. I have been jumping through hoops trying to get the capsule client to work. Raise a ticket with TAC if you have support. If not then you can download the E86 Endpoint connect client and run it. That has been my work around for this issue.
They just issued an update to the Capsule via the Microsoft Store. It seems one of the recent Windows Security Update broke the L2TP protocol within windows.

Broadcast coding from RStudio to the world with livecode package

livecode is a R package for broadcasting code for live code demonstrations. I would like to use it for teaching R in online classrooms. The package can be installed from github and runs excellent on my computer and the result is very promising. Once installed from github:
remotes::install_github("rundel/livecode")
library(livecode)
You can start your web server via server = livecode::serve_file(). Next your browser pops up and shows you a syntax-hightlighted live broadcast of your coding. A benefit in comparison to a screenshare of code is that this broadcast delivers plain text which is scalable from the recipient. I tested it on my phone, worked great. No more scaling of RStudio in order to make people see your code. Furthermore text (the script) can be saved from browser.
https://www.rstudio.com/resources/rstudioconf-2020/livecode-broadcast-your-live-coding-sessions-from-and-to-rstudio/
My problem is, I cannot figure out how to configure my private work environment such that this broadcast can be received from outside my local network. serve_file can specify an ip and port. I tried to set it to my computer ip (found via ipconfig) and open port 80 (for http) in my router.
Can anybody support me in how to make a livecode broadcast to the global internet?
I contacted the package author and he suggested to follow this blogpost:
https://bitsandbricks.github.io/post/code-live-from-rstudio-and-share-it-with-the-world-in-real-time/
It suggests to use ngrok, a service that provides tunnels to localhost. This acutally worked for me for some seconds, killing my livecode package in the next moment. At the moment, I can no longer use livecode not even as a localhost. I assume this error may just be my fault. The blogpost provides an easy answer to my question.

Why is GRPC Unavailable from a different computer?

I have been adding GPRC to a micro service I am working on. So far everything works okay, and I have a simple gatling test to verify things work correctly.
However, things only seem to work when I run gatling on the same system as my micro service. When I run the same test on a different system, I always get back an UNAVAILABLE response.
The first part of the test makes an HTTP request (port 8080), and that always succeeds, but the second part of the test makes a GRPC request (port 8081); which always succeeds on the same system, but always fails when the client is on a different system on the network.
I have tried opening up firewalls and such on Windows where the micro service is running, but no luck.
My micro service is running on Windows, and my other system is OS X.
Does anyone have any troubleshooting tips wrt GRPC?
Programmer error: I was not using the correct test host name on the GRPC port. Test works now, except that it cannot handle the same load as the HTTP test. So, something new to investigate.

MonoTouch, test if remote device is found on local network

I am using MonoTouch to develop an app which will connect to remote devices on a network. These devices have data which can be access through http queries.
If I provide a valid IP address to a controller the app works perfectly, however it hangs for a long time if the controller is not on the network. For this reason I thought it would be good to use the Reachability.cs class which can be found here:
https://github.com/xamarin/monotouch-samples/blob/master/ReachabilitySample/reachability.cs
Instead of using google.com as the host, I am using the IP address of the controller. I have read that there is a bug with this class which causes it to not like having "http" at the beginning of the URL. Having now tried numerous things to get this working I am out of ideas.
Do anyone have any suggestions? Perhaps I am reinventing the wheel here.
Having now tried numerous things to get this working I am out of ideas.
From your question it's not clear what issue you're having with the Reachability class. Maybe you could edit it and add more details ? e.g. what you tried so far, how it reacts like: never works, throws/crash, inconsistent results ...
Do anyone have any suggestions?
If your main issue is blocking the UI of your application then you could (and should anyway) do your connection and data transfer asynchronously (or a separate thread) and once completed update your UI (from the main thread).
E.g. using WebClient.DownloadDataAsync

What Causes "Internal connection fatal errors"

I've got a number of ASP.Net websites (.Net v3.5) running on a server with a SQL 2000 database backend. For several months, I've been receiving seemingly random InvalidOperationExceptions with the message "Internal connection fatal error". Sometimes there's a few days in between, while other times there are multiple errors per day.
The exception is not limited to one site in particular, though they share business and data access assemblies. The error seems to always be thrown from SqlClient.TdsParser.Run(). It sometimes is thrown from old-school direct SqlCommand.Execute() calls, while other times it is thrown from Linq2Sql code.
I've been assured by the network guys that there are no errors or packets lost on their end. Has anyone else experienced this? Could it be a driver problem? We have been unable as of yet to pinpoint a specific trigger for this exception.
We're running II6 on Windows Server 2003.
After a few months of ignoring this issue, it started to reach a critical mass as traffic gradually increased. Under heavy load, including some crawlers, things got crazy and these errors poured in nonstop.
Through trial and error, we eventually tracked down a handful of SqlCommand or LINQ queries whose SqlConnection wasn't closed immediately after use. Instead, through some sloppy programming originating from a misunderstanding of LINQ connections, the DataContext objects were disposed (and connections closed) only at the end of a request rather than immediately.
Once we refactored these methods to immediately close the connection with a C# "using" block (freeing up that pool for the next request), we received no more errors. While we still don't know the underlying reason that a connection pool would get so mixed up, we were able to cease all errors of this type. This problem was resolved in conjunction with another similar error I posted, found here: Why is my SqlCommand returning a string when it should be an int?
Sounds like the database connection is getting dropped or timing out.
We recently had similar issues moving to IIS 6 from IIS 5 connecting to SQL 2000. Our issue was solved by increasing number of ephemeral ports available.
Look at the usage of the ephemeral ports by the IIS server. The default max no. of ports available is normally 4000. You might want to consider increasing this if the sites on your server are particularly busy or your application is making a lot of database calls.
You can monitor these first to see if going over max limit.
Search Microsoft Knowledge base for "MaxUserPort" and "TcpTimedWaitDelay" and make necessary registry changes. Make sure you back up registry or snapshot server before making the changes. Will need to reboot for changes to take effect.
You should double check your database and recordset connection are being closed after use. Not closing will use up this port range unnecessarily.
Check the efficiency of your stored procedures anyway as they might be taking longer than they need too.
"If you rapidly open and close 4000 sockets in less than four minutes, you will reach the default maximum setting for client anonymous ports, and new socket connection attempts fail until the existing set of TIME_WAIT sockets times out." - from http://support.microsoft.com/kb/328476
Check your server's LOG folder (\program files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG or similar) for files named SqlDump*.mdmp and SqlDump*.txt. If you do find any you'll have to take it to Product Support.
I was creating a new EF Core project and was trying to create the database to an external Linux server instead of a Windows Server or local one. After hours of searching I found out that I am using MySQL instead of the Microsoft SQL server.
I found it weird that everyone was using 1433 instead of the usual 3306. So to fix my 'Internal connection fatal error' I had to set up a docker instance of SQL Server bound to its default port of 1433.
It literally was that simple. In the docker repo look for "microsoft-mssql-server" and run the image as described neatly in the description below. Everything works now and I am able to push my database from my EF Core project to an external server.

Resources