Executing commands by using Telnet in C# [duplicate] - c#

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
C# Telnet Library
I wish to do telnet programatically using C# so that once I establish the connection to the server, I can execute the commands like ls, ls -l, mv, rm.. etc on the server.
Is it possible? Are there classes in C# for this purpose similar to the classes for FTP (FtpWebRequest)? If yes, please direct me to the right approach.
When I execute ls, I need the list generated on server to be sent to the client i.e. windows machine in my case.

Yes, here you have a telnet library
http://www.codeproject.com/KB/IP/MinimalisticTelnet.aspx

Related

Cheking network connetion for specific network adapter using C# [duplicate]

This question already has answers here:
How to detect working internet connection in C#?
(7 answers)
Windows Service to detect network change event
(1 answer)
Closed 2 years ago.
I am using following code to check if my app is connected to internet
try
{
using (var client = new WebClient())
using (client.OpenRead("http://google.com/generate_204"))
return true;
}
catch
{
return false;
}
I want to check the connectivity of specific network adapter.
for example I have two internet connections. one is connected through WiFi and other one through ethernet cable both are from different ISP.
I only want to check the connectivity of Ethernet.
someone suggested socket.bind(). But I don't know how to use webclint() with socket.bind() kindly help with example

Is it possible to drop a tcp connection and not receive a notification/exception [duplicate]

This question already has answers here:
Is TCP 100% reliable? [closed]
(3 answers)
How reliable is a TCP connection?
(2 answers)
How reliable is .NET TCP protocol?
(5 answers)
Closed 5 years ago.
I'm currently working with the assumption that when sending TCP data with System.Net.Sockets.Socket.Send ,I am guaranteed to get an exception if the connection drops. Is it possible to have a connection drop at the OS layer without receiving a notification/exception in the C# application on top?
I don't imagine there is such a case, in .net, but how would I go about demonstrating this to someone that is skeptical.
Actually as far as i know It is possible. Imagine you create a packet send it and it gets dropped by the way. Os should automatically retransmit when ttl timesout. It will retry few times before giving up. More advanced firewalls have one small option as I remember. Drop with or without notification. Second looks like packet was 'lost' on the way to destination. They actually receive it but let's say- sends them to null without any answer.
I do not know how exactly socket.send works but from network point of view it is possible to not get confirmation for every packet that was lost/dropped.

SQL Server 2008 R2 connection string error [duplicate]

This question already has answers here:
ExecuteReader requires an open and available Connection. The connection's current state is closed
(3 answers)
Closed 8 years ago.
I have a SQL Server 2008 R2 running but when I try to connect to the server via my C# connection string I receive an error. I have no clue of what the problem is!
Here is my connection string:
_msConnection = new SqlConnection("Server=ServerIpAdress;Database=DataBaseName;User Id=NetworkName\\UserName;Password=PW;");
I hope some of you guys can help me?
Have a great day you all!
Id=NetworkName\\UserName
sounds a bit strange, try
Id=username
Also if you can connect to the DB using MS VS, MS SMS or any other likely tools your app can connect passin exactly same paramenters.
Other things to check: Actual user running the app (IIS_USR maybe)
In your SMS or VS you can get the actual connection string being used and just copy past it.

How do I open a TCPClient with a given source port? [duplicate]

This question already has an answer here:
Is there a way to specify the local port to used in tcpClient?
(1 answer)
Closed 9 years ago.
First off, I don't want to do this in production! I need to test whether someone else's implementation of a protocol on top of TCP is causing issues.
I want to use a certain outbound port over and over for multiple TCP sessions. Windows normally increments the port for each new session, and I want to circumvent this for testing. How can I set the outbound port of a TcpClient?
According to another post (Is there a way to specify the local port to used in tcpClient?). You need to use the constructor overload that takes an IPEndpoint in order to specify the local port to use.

Creating virtual serial port with C# [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Faking an RS232 Serial Port
I have an application that reads data from serial port. To test the application i would like to create a virtual serial port that generates data and puts the the port at the same PC, so that the other app can access that data.
Any idea how?
Thanks
I have used com0com tool for this. It has no direct API, but you can write an application (or a method) which starts a new com0com process to set up / modify your virtual ports "on the fly" with commandline parameters.

Categories