Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
LucianoCarvajal
Frequent Visitor

Send data through TCP to a external server

Hello everyone

I'm currently working on migrating from On-Premise to Fabric a process that sends a message through TCP connection to a external server. 

In the On-Premise version of the server it uses a bash command to send it:

echo {message_string} | timeout {timeout_int} ncat -v {domain_string} {port_int}

So now I ask the question ¿How can I do this in Microsoft Fabric?

Thanks for your help

5 REPLIES 5
v-cboorla-msft
Community Support
Community Support

Hi @LucianoCarvajal 

 

At this time, we are reaching out to the internal team to get some help on this .
We will update you once we hear back from them.
Appreciate your patience.

 

Thanks.

Hi @LucianoCarvajal 

 

I have received an update from the internal team as follows:

"We cannot just push to an unauthenticated TCP port when using Fabric". But one option if you just need to sent some text to an endpoint would be to use an event stream. You can use a custom app endpoint. You can treat this like an eventhub, AQMP or Kafka endpoint.

Please refer for more details: Add a custom app source to an eventstream - Microsoft Fabric | Microsoft Learn

 

I hope this information helps.

 

Thank you.

Hello,

Thank you for your response. However, I need more detailed information on how to use an event stream for sending a text message.

Currently, I am generating the text for the message using a pipeline, as shown in the image below:



LucianoCarvajal_0-1717425797691.png



I tried sending the message using a Notebook with the following code:

mensaje_tcp = "Hello Server!" ## The message would be the variable introduced in the notebook
host = "tcpbin.com" ## public tcp server for testing
port = 4242

import socket


def send_message_tcp(message, host, port😞
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        # Configure timeout
        s.settimeout(60)  # 60 segundos de timeout
       
        # Connect to the server
        s.connect((host, port))
       
        try:
            # Send the message
            s.sendall(message.encode())
            # Receive the response
            response = s.recv(1024)  # Adjust buffer size as needed
            print("Response:", response.decode())
           
            if response:
                print("Mensaje enviado correctamente.")
            else:
                print("Error: No se recibió respuesta del servidor.")
                raise Exception(f"ERROR: No se recibió respuesta del servidor.")
               
        except socket.timeout:
            print("Error: tiempo de espera agotado. No se recibió respuesta del servidor.")
            raise Exception(f"ERROR: Tiempo de espera agotado. No se recibió respuesta del servidor.")


# Envío TCP
send_message_tcp(mensaje_tcp, host, port)




Initially, this worked, but it has since stopped working, and I'm not sure why.

Could you please provide guidance on how to integrate this process with a stream? I assume the pipeline would need to send the generated text to the stream, and then maybe an Azure Function would consume the stream and forward the text to the TCP destination.

f that's the case, can the Azure Function send data to an unauthenticated TCP server?

Thank you for your assistance.



Hi @LucianoCarvajal 

 

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others.
Otherwise, will respond back with the more details and we will try to help.

 

Thanks.

Hi @LucianoCarvajal 

 

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others .
If you have any question relating to the current thread, please do let us know and we will try out best to help you.
In case if you have any other question on a different issue, we request you to open a new thread.

 

Thanks.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.