Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4099058
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:23:02+00:00 2026-05-20T20:23:02+00:00

I want to send and receive some data from my server, but I don’t

  • 0

I want to send and receive some data from my server, but I don’t know how to do this…

Basically I want to:
Send:
“some string”
To:
IP: 10.100.200.1
Port: 30000

Receive/read the response

Can someone give me some basic example or point me to a simple (working) tutorial?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:23:03+00:00Added an answer on May 20, 2026 at 8:23 pm

    Simple synchronous TcpClient sending a text string and receiving a text string.

    using System;
    using System.IO;
    using System.Net;
    using System.Text;
    using System.Net.Sockets;
    
    public class SimpleTcpClient {
    
        public static void Main() {
    
            TcpClient tcpclnt = new TcpClient();            
            tcpclnt.Connect("10.100.200.1",30000);
    
            String textToSend = "HelloWorld!";
            Stream stm = tcpclnt.GetStream();
    
            ASCIIEncoding asen = new ASCIIEncoding();
            byte[] data = asen.GetBytes(textToSend);
    
            stm.Write(data,0,data.Length);
    
            //You might want to wait a bit for an answer (Thread.Sleep or simething)
    
            byte[] responseData = new byte[1024];
            string textRecevided = "";
            int read = 0;               
            do {  
                read = stm.Read(responseData, 0, responseData.Length);
                for (int i=0; i < read; i++)
                {
                    textRecevided += (char)responseData[i];
                }           
            } while (read > 0);
    
            Console.Write(textRecevied);
    
            tcpclnt.Close();
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to transfer (send or receive) a hash from client to server.
I want to send and receive commands like dir and so on but i
Hello Sir i want send list of data to php server i use following
I want to send this URL as a request to the server to change
I want to receive data from a client. To be precise, all data the
I want some help on a way to transfer data from a python web
How can i send a data from Server to android directly without waiting for
i want to make an app that receives some data from android client and
I want to be a able to securely send data from my Android App
I'm using the ASIHTTPRequest package to send some data from the iPhone to my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.