none
How to build Simple TCPIP Listener in C# Window Form Application RRS feed

  • Question

  • i want to received data from Machine to computer through TCPIP .

    Kindly guide us how to build a simple TCPIP Listener in C# Window Form Application  . Received data from Machine  show in Text Box . 

    Monday, September 24, 2018 4:47 PM

Answers

All replies

  • Good place to start :

    TCP Client and Server

    - Bio.


    Please visit my blog : http://limbioliong.wordpress.com/

    Monday, September 24, 2018 6:04 PM
  • Hi saqsaqPK,

    Thank you for posting here.

    For your question, you could download source file from the link of code project below.

    https://www.codeproject.com/Articles/5733/A-TCP-IP-Server-written-in-C

    https://www.codeproject.com/Articles/1215517/TCPIP-Server-and-Client-example

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 25, 2018 3:21 AM
    Moderator
  • Thanks for your Reply 

    build Window Form Application 

    Server is start  successfully and ready for lisining 

    Kindly Advise us how to  Received data and show in Text Box Kindly Advise me .

    namespace MyFirtsTCPIPLisner
    {
        public partial class Form1 : Form
        {
            string HostName = Dns.GetHostName(); 
            // Get Host Name when Form is load 
            private object myList;
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
               LabelHost.Text = HostName;
             // Get IP Address of Current Computer 
                      
            }
    
            private void ButtonStartServer_Click(object sender, EventArgs e)
            {
                String MyIP = Dns.GetHostByName(HostName).AddressList[0].ToString();
                IPAddress IPAd = IPAddress.Parse(MyIP);
                TcpListener myList = new TcpListener(IPAd, 8000);
                LabelMyIPAddress.Text = MyIP.ToString();
                myList.Start();
                LabelServerStatus.Text = ("Server is Start on Following IP "+IPAd ); 
            }
    

    Tuesday, September 25, 2018 1:51 PM
  • Anybody help me to to solved this issue . 

    how to received data in Text Box 

    Wednesday, September 26, 2018 6:23 AM
  • Hi saqsaqPK,

    If you want to do TCPListener in Winform, you need to notice the UI.

    Please download the source file from the code project. It is a example with TCPListener in Winform.

    https://www.codeproject.com/Articles/2418/Making-Socket-Based-Application-Using-TcpListener

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by saqsaqPK Friday, July 26, 2019 5:22 PM
    Tuesday, October 9, 2018 5:41 AM
    Moderator