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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Send message using TCP protocol 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?

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



LucianoCarvajal_0-1717708708467.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(messagehostport) :

 

    with socket.socket(socket.AF_INET, socket.SOCK_STREAMas 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.


I was told that an event stream could be used for doing this, but i need some guidance on how.

Thanks !

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

1.Start by setting up an eventstream item. This will be your central configuration for capturing and routing messages.

2.Since you're targeting an external server over TCP, you'll need a custom application that can act as a bridge. This app will consume messages from the eventstream and forward them to your external server using TCP. The custom app can be hosted in a container or a VM within Azure, ensuring it has network access to your target server.

3.Configure the Eventstream to Use Your Custom App as a Destination.

 

Please refer: Add custom app source to an eventstream - Microsoft Fabric | Microsoft Learn

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

1.Start by setting up an eventstream item. This will be your central configuration for capturing and routing messages.

2.Since you're targeting an external server over TCP, you'll need a custom application that can act as a bridge. This app will consume messages from the eventstream and forward them to your external server using TCP. The custom app can be hosted in a container or a VM within Azure, ensuring it has network access to your target server.

3.Configure the Eventstream to Use Your Custom App as a Destination.

 

Please refer: Add custom app source to an eventstream - Microsoft Fabric | Microsoft Learn

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Fabric Update Carousel

Fabric Monthly Update - March 2026

Check out the March 2026 Fabric update to learn about new features.

Top Solution Authors
Top Kudoed Authors