none
Low-Level TCP/Udp Socket class for use in C# project RRS feed

  • Question

  • How can use low-level socket in C# project.

    I need very fast data processing/flow in my financial broadcast/ordering application.

    We implemented using inbuilt socket classes, and that working fine. Recently i come to know about some Low-Level socket programming.

    I found a project in codeproject 

    http://www.codeproject.com/Articles/34163/A-Universal-TCP-Socket-Class-for-Non-blocking-Serv

    I dont have knowledge about CPP but i tried to compile it into dll and use that to make sample project in C#. But adding reference is not working.

    Is there any way to implement this kind of low level socket program in C#?

    OR any way to use give socket in my c# project?


    Jiten Patoliya Windows C# developer

    Thursday, September 25, 2014 7:40 AM

Answers

  • Hello Jiten Patoliya,

    For your first part,

    Is there any way to implement this kind of low level socket program in C#?

    Please have a look at this article for a start:http://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx

    "Platform Invocation Services (PInvoke) allows managed code to call unmanaged functions that are implemented in a DLL.

    This tutorial shows you what you need to do to be able to call unmanaged DLL functions from C#. The attributes discussed in the tutorial allow you to call these functions and have data types be marshaled correctly."

    We use PInvoke to help us get the dll called by C#. Here is a code sample from codeproject:

    How to Marshal a C++ Class http://www.codeproject.com/Articles/18032/How-to-Marshal-a-C-Class

    For your second part

    OR any way to use give socket in my c# project?

    Please see a good blog in C#

    Get Closer to the Wire with High-Performance Sockets  in .NET http://msdn.microsoft.com/en-us/magazine/cc300760.aspx May useful for you in this scenario.

    Best regards,



    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, September 26, 2014 2:32 AM
    Moderator