.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Full duplex pc to half duplex serial communication with SerialPort class in C++ (but any language wi

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :.NET Framework

Hello.  I am a bit new to the .NET environment, and though I feel I was able to get a good handle on most of the basics of .NET, I believe I've encountered a problem beyond the basics.  I am trying to talk with a device called a ColorPAL that uses asynchronous serial communication, but it is half-duplex instead of full-duplex.  I am able to send it the hex string commands that it wants just fine with the TX line.  However, I find myself unable to read because the RX isn't connected to anything.  Basically what I want to do is that I want to be able to swap the TX line to become a RX line so that I can then read line of the half-duplex.  I read that there is a PinChanged event, so it lead me to believe there is a way to change pins??   If the RX line is very high impedance I could connect it to the TX line, but I have no idea about that.


How can I get a full duplex to read a half-duplex using the visual studio software?


Here is the code I'm using, in case that helps.

#include "stdafx.h"
#include <Windows.h>

using namespace System;
using namespace 

View Complete Post

More Related Resource Links

FAQ: How do I use the SerialPort Class for simple serial communications?

How do I use the SerialPort Class for simple serial communications?Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

Duplex communication and calling clients from outside the hosted service

Hey,   I am currently building an interface between two applications: One that hosts a WCF service and receives external input (e.g. from a sensory system) and another which subscribes to updates sent by the first.   It is quite easy to call back to the client if I create a ServiceHost and provide it with an instance of my service (using ServiceHost.SingletonInstance). However, if I use a PerSession instance mode, how is it possible to call the clients when I receive an updated from the external sensory system?   Thank you for your time!   Cheers, Till

WCF Duplex Communication



   I have a question on duplex communication. When we request a from a client to the service and if the service do not respond back to the client with in the timeout period. The communication between client and service will be broken. Then how can i make the client to continue the communication with the service. Please help me how can i handle this type of situations.

Thanks in Advance.

RestFul Services for CallBack(Duplex communication)



I am able to implementing restful wcf service but now i want to use callback with it.Is it possible ?As i am getting some errors can anyone provide any Link for Restful WCF service callback.



Serial Communication with the .NET Compact Framework

Learn how to make your applications communicate over a serial port and how to handle common issues when implementing serial solutions. After a general discussion about serial communication and a common serial communication standard, this article demonstrates a practical use of the technologies through sample source code written in C#.

Serial Port Communication Read and Write using C#.net

In this simple article you will learn that how you can Open and read COM port data using System.IO.Ports Namespace.
Simply just create New Project of windows application in C#.

Import ServiceProcess APIs
using System.IO.Ports

Imports System.IO.Ports

Write Parsing functions which parse port data according to attached device

Error : Polling duplex in WCF DotNet4.0


We are making sample polling duplex in .net 4.0.

when ever we are  binding this tag in web.config it shows below error.




Warning    1    The element 'bindings' has invalid child element 'pollingDuplexHttpBinding'. List of possible elements expected: 'basicHttpBinding, customBinding, msmqIntegrationBinding, netPeerTcpBinding, netMsmqBinding, netNamedPipeBinding, netTcpBinding, wsFederationHttpBinding, ws2007FederationHttpBinding, wsHttpBinding, ws2007HttpBinding, wsDualHttpBinding, netTcpContextBinding, wsHttpContextBinding, basicHttpContextBinding, mexHttpBinding, mexHttpsBinding, mexNamedPipeBinding, mexTcpBinding, webHttpBinding'.    D:\DuplexTest\TestPollingDuplexWcf\TestPollingDuplexWcf\TestPollingDuplexWcf\Web.config    9    8    TestPollingDuplexWcf

Robotics: Writing and Testing VPL Services for Serial Communication


VPL, part of Robotics Developer Studio is intended for novice programmers, but is also useful for testing and prototyping. We write a simple serial port service that allows you to send and receive data.

Trevor Taylor

MSDN Magazine February 2010

Serial Comm: Use P/Invoke to Develop a .NET Base Class Library for Serial Device Communications


Out-of-the-box, the only way of coding RS232 serial communications applications in the .NET environment is to import the outdated and somewhat limited MSComm ActiveX control. This article describes the development of a lean, multithreaded, and modern RS232 base class library in C# managed code. The library uses Platform Invocation Services to interact with the Win32 API directly. Application programmers can use the library from any .NET language through inheritance; the article explores examples written in C# and Visual Basic .NET.

John Hind

MSDN Magazine October 2002

Duplex contract between web client and server?

Hi, Can duplex contract be implemented between web client and server using http as a transport?   Thanks jagaurg

Try-Catch block cannot handle exceptions when contacting a Silverlight Client using net.tcp Duplex W

I have created a simple duplex WCF for Silverlight 4 clients, using net.tcp binding (.NET Framework 4.0)  The client interface is declared as <ServiceContract()> _ Public Interface IServiceClient <OperationContract(IsOneWay:=True)> _ Sub SendUpdate(ByVal allRecords As List(Of String)) End Interface while the service interface is declared as <ServiceContract(Namespace:="SilverlightService", CallbackContract:=GetType(IServiceClient))> _ Public Interface IService <OperationContract(IsOneWay:=True)> _ Sub Connect() End Interface The service code is implemented like: <ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple, InstanceContextMode:=InstanceContextMode.Single)> _ <Activation.AspNetCompatibilityRequirementsAttribute(RequirementsMode:=Activation.AspNetCompatibilityRequirementsMode.Allowed)> _ Public Class Service Implements IService 'Keep the list of all the active/connected clients: Public _clients As List(Of IServiceClient) = New List(Of ITrackServiceClient) Public Sub Connect() Implements IService.Connect Dim client = OperationContext.Current.GetCallbackChannel(Of IServiceClient)() Dim clientExist = From p In _clients _ Where p Is client _ Select p If clientExist.Count() = 0 Then Monitor.Enter(_clients) _clients.Add(client) Monitor.E

Setting printer duplex programatically

How do you programmatcally set a printer to duplex?   The information I've found online indicates that GetPrinter/SetPrinter should do the trick, but so far I've had mixed results.    I'm automating Microsoft Word to print documents.  Some of the documents required to be duplexed.  So far in my research I've found the following web pages that provide somewhat helpful information. http://support.microsoft.com/default.aspx/kb/315720 How to enable and disable a printer by using the SetPrinter function in Visual C# http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q140/2/85.asp&NoWebContent=1 How To Modify Printer Settings by Using SetPrinter http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q167/3/45.asp&NoWebContent=1 How To Modify Printer Settings with the DocumentProperties() Function http://support.microsoft.com/kb/828638  How to set duplex printing for Microsoft Word Automation clients (This article appears to be starting pointing for the CodeProject article) http://www.codeproject.com/dotnet/NET_Printer_Library.asp  Changing printer settings using C# I've included the code I'm using now.  I don't get any errors and everything appears to work, but the Duplex setting on the printer is not set reliably.  My check is to open the printer's properties and the "Pr

Duplex CallContract Issue.

Hi All, I am implimenting Duplex CallBack Contract for my Service. I am giving my Callback Interface Below.   public interface IAsyncCallbackInterface { [ OperationContract(IsOneWay = true)]   void GetTheCurrentChannel(DuplexChannelFactory<IAsyncInterface> factory); } So when i am trying to open the host i am getting following error Type 'System.ServiceModel.DuplexChannelFactory`1[IAsyncInterface]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  See the Microsoft .NET Framework documentation for other supported types. Here the IAsyncInterface is my ServiceContract. Since it is an interface how can i mark it as DataContract? Can any one plse tell me what is the issue here? Thanks Lijo

Is WCF Duplex Service scalable?

Hi all, I would please like to know if the WCF Duplex service can be used to push data e.g. realtime prices to thousands of silverlight clients. I have read this article (http://dotnetaddict.dotnetdevelopersjournal.com/sl_polling_duplex.htm) that says that it isn't scalable. I know there are several commercial platforms as described in this article (http://blog.programmableweb.com/2010/09/14/client-push-services-open-up-real-time-to-everyone/) that can provide real time push services but I'd like to know if there are any other options I could consider other than using a commercial platform? Thanks.

CommunicationException - WSDualHTTPBinding (duplex)


Hey, I'm having a problem. I'm running a self-hosting console application as a WCF service, which sets up an endpoint configured to use the WSDualHTTPBinding. Whenever a client connects to the service I store the "CallBackChannel" on the server, which I use to call "callback" functions on the client.

However sometimes I suddenly recieve an exception called "CommunicationException" saying "The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

How do I proceed on finding the source to this problem? I've made sure the contracts are all ok. But I don't know what to do from here.

Thanks in advance.

Why doesn't Visual Studio support MSIL as a first class language?


I'm dissapointed that Visual Studio (I'm running VS 2008) doesn't support IL as a project language, so that we can select it when starting a new project. We could then edit/assemble in VS and build debug test etc just like any other language. There seems to be no support for this either from MS or as an add-on.

The main motivation is to ease the development of dynamic methods, where we can actually see the stack, operations, memory etc in a proper debugger, right now developing dynamic methods is hit and miss, and very time consuming to debug (because the only assembler we can see in VS is native CPU !)

Also even if I debug C# code and select assembler in the source window I do NOT see IL assembler, only the jitted native assembler.

Is there any way to debug IL as IL, and see the stack etc etc?


Suitable Stream class for TCP communication



I have client and server that communicate with byte arrays.

The array is composed from [pavket id][packet size][data] in LITTLE_ENDIAN byte order.

The [data] is also build with the following format: 4 bytes(int) for chunk size, chunk, 4 bytes chunk size.....

Currently, I use a plain stream and reads the byte array and dissecting the data part by part.

Is there a library class where I can read int,short,string... from the byte array by start + length?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend