Creating virtual serial port with C# [duplicate] - c#

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.

Related

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.

C# Print Monitor Service [duplicate]

This question already has answers here:
How do I retrieve a list or number of jobs from a printer queue?
(2 answers)
Closed 9 years ago.
I am trying to write a service that monitors the printers queue in C# that sends the information of a current print job (Document name, pages printed, paper media size) to an another application possibly that will then popup (like the Windows Msg "document has been sent to printer"). I am not sure if there is any examples or if anybody knows what classes are best used, being the printers are on a Windows printer server.
Thanks,
How do I retrieve a list or number of jobs from a printer queue? also doesn't completely match what I am asking, so read before marking as duplicate which it isn't.
Look into the System.Printing.PrintQueue class and the System.Printing.LocalPrintServer class - especially the GetDefaultPrintQueue method on the LocalPrintServer class

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.

Executing commands by using Telnet in C# [duplicate]

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

Add my C# windows application as a printer in windows [duplicate]

This question already has answers here:
Writing a Virtual Printer in .NET [closed]
(7 answers)
Closed 5 years ago.
I am a fresher in c#. I have developed an application that can convert a postscript file(.ps) to formats like PDF,JPEG, ets,. My intention is to develop a pdf printer. So how do I add this application as a printer in windows xp or above. Or say how do I get the PS file when CTRL+P is pressed on any windows application.
This is not a network printer, its a printer that needs to be assigned to a local print port and not a network port.
You are asking, how to make a virtual printer in C#, a very good question, and an easy one, you can use some thing called:
- Virtual Printer Port Redirection, you can see the following questions and articles, they are very related to yours:
Writing a Virtual Printer in .NET
Configure Virtual Printer Port Redirection
http://msdn.microsoft.com/en-us/library/windows/hardware/br259124

Categories