Click here to Skip to main content
15,902,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Thanks in Advance.

I have developed one Asynchronous Socket Server in C# [Console Application]. Main functionality of this server is to communicate with Hardware. This socket server receives data from client and sends to specific device. For sending data to hardware, dll is used. 3 dll functions are imported.

C#
[DllImport(m_strPath, CharSet = CharSet.Auto)]
        public static extern int Net_Init(uint dwIP, int nIPPort, uint dwIDCode, int nTimeOut);

        [DllImport(m_strPath, CharSet = CharSet.Auto)]
        public static extern int Net_SendPicture(int nCardID, int nWndNo, int nPosX, int nPosY, int nCx, int nCy, IntPtr pPictureFile, int nSpeed, int nEffect, int nStayTime, int nPictRef);

        [DllImport(m_strPath, CharSet = CharSet.Auto)]
        public static extern int Net_SendText(int nCardID, int nWndNo, IntPtr pText, int crColor, int nFontSize, int nSpeed, int nEffect, int nStayTime, int nAlignment);

         [DllImport(m_strPath, CharSet = CharSet.Auto)]
        public static extern int Net_Disconnect();


When I am receiving request I am sending data to specific device. As request are multiple,
data is getting sent to other device.


For example

Thread 1 Req-1 Received
Req-1-Init Method Called for IP 2
Req-1-Sending text
Thread 2 Req-2 Received
Req-2-Init Method Called for IP 2
Req-1-Sending Picture ---------- Picture is getting sent to second hardware
Req-2-sendding Text
Req-1-Disconnect
Req-2-sending Picture

Please let me know the good approach so using Asynchronous client I can send data to hardware.
using DLL.

What I have tried:

I googled about synchronous Server but asynchronous socket server is best.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900