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

  • SEARCH
  • Home
  • 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 8159515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:56:41+00:00 2026-06-06T17:56:41+00:00

A (sort of – it’s not directly to do with C#) related question in

  • 0

A (sort of – it’s not directly to do with C#) related question in SO is: How to insert data in OpenTSDB (Time Series Database); as mentioned there, the basic shell command which easily works (in linux) is as follows:

echo "put mymetric.data_1 1295643636 48 a=foo" | nc -w 15 tsdHost tsdPort

My question is has anyone written a collector in C# for OpenTSDB? The issue I am facing is that although I can open a Socket to the tsd instance/port and I write the following to its stream, nothing seems to happen.

put mymetric.data_1 1295643636 48 a=foo

I am creating an InterNetwork, Stream based TCP Socket, and tried sending the above string as ASCII, UTF-8,-16 and -32 encoded bytes, all in vain.

Any pointers in what kind of Socket and what kind of encoded bytes I need to use will really help. The Java code sample for the same thing I am trying to achieve is:

Socket sock = new Socket("tsd.server.com", 4242); 
String point = "put my.metric 1314137008 60 host=someplace.net foo=1\n"; 
sock.getOutputStream().write(point.getBytes()); 
sock.close();
  • 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-06-06T17:56:44+00:00Added an answer on June 6, 2026 at 5:56 pm

    I just realized the string that I was sending did not have the newline character at the end. In the Java code sample, the newline is there explicitly.

    Adding a newline at the end resolved the problem.

    Sample code where you add the newline explicitly:

    string message = "put mymetric.data_1 1295643636 48 a=foo";
    IPAddress ip = IPAddress.Parse("xxx.xxx.xxx.xxx"); // tsdb deamon host ip
    IPEndPoint endPoint = new IPEndPoint(ip, 4242); // tsdb deamon port
    
    using (Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
    {
        s.Connect(endPoint);
        s.Send(new ASCIIEncoding().GetBytes(message + Environment.NewLine));
        s.Close();  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

related (sort of) to this question. I have written a script that will loop
Sort of a Linq beginners question, but is there a simple built-in way to
Sort of noob-rails question ;): I've got 2 actions in my controller - index
Sort of a methods/best practices question here that I am sure has been addressed,
Comparison sort is opted for in most of the scenarios where data needs to
Sort of a continuation from an earlier question, done a bunch of googling, but
Sort of a spinoff of this question. Do you keep them in the source
Sort of a fringy, non-practical question coming along here. You know that in Perl
Sort descriptors with custom blocks are not supported in iOS6, so I need to
I sort of understand closures in javascript, but what I'm not sure about is

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.