kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: String concatenation
Java: public class Str{
   public static void main(String[] args){
      String s = "hello";
      System.out.println(s + " literal");
      String s2 = s + " literal";
      System.out.println(s2);
   }
}

VB: Option Explicit

Sub String_Concatenation()
Dim str1 As String, str2 As String

    str1 = "Rosetta"
    Debug.Print str1
    Debug.Print str1 & " code!"
    str2 = str1 & " code..."
    Debug.Print str2 & " based on concatenation of : " & str1 & " and code..."
End Sub
Task: String concatenation
C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *sconcat(const char *s1, const char *s2)
{
  char *s0 = malloc(strlen(s1)+strlen(s2)+1);
  strcpy(s0, s1);
  strcat(s0, s2);
  return s0;
}

int main()
{
   const char *s = "hello";
   char *s2;
   
   printf("%s literal\n", s);
   
   printf("%s%s\n", s, " literal");
   
   s2 = sconcat(s, " literal");
   puts(s2);
   free(s2);
}

Go: package main

import "fmt"

func main() {
    
    s := "hello"

    
    fmt.Println(s)

    
    
    fmt.Println(s + " literal")

    
    s2 := s + " literal"

    
    fmt.Println(s2)
}
Task: String concatenation
C#: using System;
namespace StringConcatenation
{
  class Program {
    static void Main() {
        String s = scope ("hello");
        Console.Write(s);
        Console.WriteLine(" literal");
        s.Append(" literal");
        Console.WriteLine(s);
    }
  }
}

C++: #include <string>
#include <iostream>

int main() {
   std::string s = "hello";
   std::cout << s << " literal" << std::endl;
   std::string s2 = s + " literal";
   std::cout << s2 << std::endl;
   return 0;
}
Task: String concatenation
C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *sconcat(const char *s1, const char *s2)
{
  char *s0 = malloc(strlen(s1)+strlen(s2)+1);
  strcpy(s0, s1);
  strcat(s0, s2);
  return s0;
}

int main()
{
   const char *s = "hello";
   char *s2;
   
   printf("%s literal\n", s);
   
   printf("%s%s\n", s, " literal");
   
   s2 = sconcat(s, " literal");
   puts(s2);
   free(s2);
}

PHP: <?php
$s = "hello";
echo $s . " literal" . "\n";
$s1 = $s . " literal";
echo $s1 . "\n";
?>
Task: String concatenation
C#: using System;
namespace StringConcatenation
{
  class Program {
    static void Main() {
        String s = scope ("hello");
        Console.Write(s);
        Console.WriteLine(" literal");
        s.Append(" literal");
        Console.WriteLine(s);
    }
  }
}

PHP: <?php
$s = "hello";
echo $s . " literal" . "\n";
$s1 = $s . " literal";
echo $s1 . "\n";
?>
Task: String concatenation
C++: #include <string>
#include <iostream>

int main() {
   std::string s = "hello";
   std::cout << s << " literal" << std::endl;
   std::string s2 = s + " literal";
   std::cout << s2 << std::endl;
   return 0;
}

PHP: <?php
$s = "hello";
echo $s . " literal" . "\n";
$s1 = $s . " literal";
echo $s1 . "\n";
?>
Task: String concatenation
Go: package main

import "fmt"

func main() {
    
    s := "hello"

    
    fmt.Println(s)

    
    
    fmt.Println(s + " literal")

    
    s2 := s + " literal"

    
    fmt.Println(s2)
}

PHP: <?php
$s = "hello";
echo $s . " literal" . "\n";
$s1 = $s . " literal";
echo $s1 . "\n";
?>
Task: String concatenation
Java: public class Str{
   public static void main(String[] args){
      String s = "hello";
      System.out.println(s + " literal");
      String s2 = s + " literal";
      System.out.println(s2);
   }
}

PHP: <?php
$s = "hello";
echo $s . " literal" . "\n";
$s1 = $s . " literal";
echo $s1 . "\n";
?>
Task: String concatenation
Python: s1 = "hello"
print s1 + " world"

s2 = s1 + " world"
print s2

PHP: <?php
$s = "hello";
echo $s . " literal" . "\n";
$s1 = $s . " literal";
echo $s1 . "\n";
?>
Task: String concatenation
VB: Option Explicit

Sub String_Concatenation()
Dim str1 As String, str2 As String

    str1 = "Rosetta"
    Debug.Print str1
    Debug.Print str1 & " code!"
    str2 = str1 & " code..."
    Debug.Print str2 & " based on concatenation of : " & str1 & " and code..."
End Sub

PHP: <?php
$s = "hello";
echo $s . " literal" . "\n";
$s1 = $s . " literal";
echo $s1 . "\n";
?>
Task: Sockets
C: #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

const char *msg = "hello socket world";

int main()
{
   int i, sock, len, slen;

   struct addrinfo hints, *addrs;  
   memset(&hints, 0, sizeof(struct addrinfo));
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
   
   if (0 == getaddrinfo("localhost", "256", &hints, &addrs))
   {
       sock = socket(addrs->ai_family, addrs->ai_socktype, addrs->ai_protocol);
       if ( sock >= 0 )
       {
           if ( connect(sock, addrs->ai_addr, addrs->ai_addrlen) >= 0 )
           {
               const char *pm = msg;
               do
               {
                  len = strlen(pm);
                  slen = send(sock, pm, len, 0);
                  pm += slen;
               } while ((0 <= slen) && (slen < len));
           }
           close(sock);
       }
       freeaddrinfo(addrs);
   }
}

C#: using System;
using System.IO;
using System.Net.Sockets;

class Program {
    static void Main(string[] args) {
        TcpClient tcp = new TcpClient("localhost", 256);
        StreamWriter writer = new StreamWriter(tcp.GetStream());

        writer.Write("hello socket world");
        writer.Flush();

        tcp.Close();
    }
}
Task: Sockets
C: #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

const char *msg = "hello socket world";

int main()
{
   int i, sock, len, slen;

   struct addrinfo hints, *addrs;  
   memset(&hints, 0, sizeof(struct addrinfo));
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
   
   if (0 == getaddrinfo("localhost", "256", &hints, &addrs))
   {
       sock = socket(addrs->ai_family, addrs->ai_socktype, addrs->ai_protocol);
       if ( sock >= 0 )
       {
           if ( connect(sock, addrs->ai_addr, addrs->ai_addrlen) >= 0 )
           {
               const char *pm = msg;
               do
               {
                  len = strlen(pm);
                  slen = send(sock, pm, len, 0);
                  pm += slen;
               } while ((0 <= slen) && (slen < len));
           }
           close(sock);
       }
       freeaddrinfo(addrs);
   }
}

C++: 

#include <boost/asio.hpp>

int main()
{
  boost::asio::io_context io_context;
  boost::asio::ip::tcp::socket sock(io_context);
  boost::asio::ip::tcp::resolver resolver(io_context);
  boost::asio::ip::tcp::resolver::query query("localhost", "4321");

  boost::asio::connect(sock, resolver.resolve(query));
  boost::asio::write(sock, boost::asio::buffer("Hello world socket\r\n"));

  return 0;
}
Task: Sockets
C: #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

const char *msg = "hello socket world";

int main()
{
   int i, sock, len, slen;

   struct addrinfo hints, *addrs;  
   memset(&hints, 0, sizeof(struct addrinfo));
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
   
   if (0 == getaddrinfo("localhost", "256", &hints, &addrs))
   {
       sock = socket(addrs->ai_family, addrs->ai_socktype, addrs->ai_protocol);
       if ( sock >= 0 )
       {
           if ( connect(sock, addrs->ai_addr, addrs->ai_addrlen) >= 0 )
           {
               const char *pm = msg;
               do
               {
                  len = strlen(pm);
                  slen = send(sock, pm, len, 0);
                  pm += slen;
               } while ((0 <= slen) && (slen < len));
           }
           close(sock);
       }
       freeaddrinfo(addrs);
   }
}

VB: Imports System
Imports System.IO
Imports System.Net.Sockets

Public Class Program 
    Public Shared Sub Main(ByVal args As String[])
        Dim tcp As New TcpClient("localhost", 256)
        Dim writer As New StreamWriter(tcp.GetStream())

        writer.Write("hello socket world")
        writer.Flush()

        tcp.Close()
    End Sub
End Class
Task: Sockets
C#: using System;
using System.IO;
using System.Net.Sockets;

class Program {
    static void Main(string[] args) {
        TcpClient tcp = new TcpClient("localhost", 256);
        StreamWriter writer = new StreamWriter(tcp.GetStream());

        writer.Write("hello socket world");
        writer.Flush();

        tcp.Close();
    }
}

C++: 

#include <boost/asio.hpp>

int main()
{
  boost::asio::io_context io_context;
  boost::asio::ip::tcp::socket sock(io_context);
  boost::asio::ip::tcp::resolver resolver(io_context);
  boost::asio::ip::tcp::resolver::query query("localhost", "4321");

  boost::asio::connect(sock, resolver.resolve(query));
  boost::asio::write(sock, boost::asio::buffer("Hello world socket\r\n"));

  return 0;
}
Task: Sockets
C++: 

#include <boost/asio.hpp>

int main()
{
  boost::asio::io_context io_context;
  boost::asio::ip::tcp::socket sock(io_context);
  boost::asio::ip::tcp::resolver resolver(io_context);
  boost::asio::ip::tcp::resolver::query query("localhost", "4321");

  boost::asio::connect(sock, resolver.resolve(query));
  boost::asio::write(sock, boost::asio::buffer("Hello world socket\r\n"));

  return 0;
}

Go: package main
 
import (
    "fmt"
    "net"
)
 
func main() {
    conn, err := net.Dial("tcp", "localhost:256")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer conn.Close()
    _, err = conn.Write([]byte("hello socket world"))
    if err != nil {
        fmt.Println(err)
    }
}
Task: Sockets
C++: 

#include <boost/asio.hpp>

int main()
{
  boost::asio::io_context io_context;
  boost::asio::ip::tcp::socket sock(io_context);
  boost::asio::ip::tcp::resolver resolver(io_context);
  boost::asio::ip::tcp::resolver::query query("localhost", "4321");

  boost::asio::connect(sock, resolver.resolve(query));
  boost::asio::write(sock, boost::asio::buffer("Hello world socket\r\n"));

  return 0;
}

Java: import java.io.IOException;
import java.net.*;
public class SocketSend {
  public static void main(String args[]) throws IOException {
    sendData("localhost", "hello socket world");
  }

  public static void sendData(String host, String msg) throws IOException {
    Socket sock = new Socket( host, 256 );
    sock.getOutputStream().write(msg.getBytes());
    sock.getOutputStream().flush();
    sock.close();
  }
}
Task: Sockets
C++: 

#include <boost/asio.hpp>

int main()
{
  boost::asio::io_context io_context;
  boost::asio::ip::tcp::socket sock(io_context);
  boost::asio::ip::tcp::resolver resolver(io_context);
  boost::asio::ip::tcp::resolver::query query("localhost", "4321");

  boost::asio::connect(sock, resolver.resolve(query));
  boost::asio::write(sock, boost::asio::buffer("Hello world socket\r\n"));

  return 0;
}

Python: import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 256))
sock.sendall("hello socket world") 
sock.close()
Task: Sockets
C++: 

#include <boost/asio.hpp>

int main()
{
  boost::asio::io_context io_context;
  boost::asio::ip::tcp::socket sock(io_context);
  boost::asio::ip::tcp::resolver resolver(io_context);
  boost::asio::ip::tcp::resolver::query query("localhost", "4321");

  boost::asio::connect(sock, resolver.resolve(query));
  boost::asio::write(sock, boost::asio::buffer("Hello world socket\r\n"));

  return 0;
}

VB: Imports System
Imports System.IO
Imports System.Net.Sockets

Public Class Program 
    Public Shared Sub Main(ByVal args As String[])
        Dim tcp As New TcpClient("localhost", 256)
        Dim writer As New StreamWriter(tcp.GetStream())

        writer.Write("hello socket world")
        writer.Flush()

        tcp.Close()
    End Sub
End Class
Task: Sockets
C#: using System;
using System.IO;
using System.Net.Sockets;

class Program {
    static void Main(string[] args) {
        TcpClient tcp = new TcpClient("localhost", 256);
        StreamWriter writer = new StreamWriter(tcp.GetStream());

        writer.Write("hello socket world");
        writer.Flush();

        tcp.Close();
    }
}

Java: import java.io.IOException;
import java.net.*;
public class SocketSend {
  public static void main(String args[]) throws IOException {
    sendData("localhost", "hello socket world");
  }

  public static void sendData(String host, String msg) throws IOException {
    Socket sock = new Socket( host, 256 );
    sock.getOutputStream().write(msg.getBytes());
    sock.getOutputStream().flush();
    sock.close();
  }
}
Task: Sockets
C#: using System;
using System.IO;
using System.Net.Sockets;

class Program {
    static void Main(string[] args) {
        TcpClient tcp = new TcpClient("localhost", 256);
        StreamWriter writer = new StreamWriter(tcp.GetStream());

        writer.Write("hello socket world");
        writer.Flush();

        tcp.Close();
    }
}

VB: Imports System
Imports System.IO
Imports System.Net.Sockets

Public Class Program 
    Public Shared Sub Main(ByVal args As String[])
        Dim tcp As New TcpClient("localhost", 256)
        Dim writer As New StreamWriter(tcp.GetStream())

        writer.Write("hello socket world")
        writer.Flush()

        tcp.Close()
    End Sub
End Class
Task: Sockets
Go: package main
 
import (
    "fmt"
    "net"
)
 
func main() {
    conn, err := net.Dial("tcp", "localhost:256")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer conn.Close()
    _, err = conn.Write([]byte("hello socket world"))
    if err != nil {
        fmt.Println(err)
    }
}

Java: import java.io.IOException;
import java.net.*;
public class SocketSend {
  public static void main(String args[]) throws IOException {
    sendData("localhost", "hello socket world");
  }

  public static void sendData(String host, String msg) throws IOException {
    Socket sock = new Socket( host, 256 );
    sock.getOutputStream().write(msg.getBytes());
    sock.getOutputStream().flush();
    sock.close();
  }
}
Task: Sockets
Java: import java.io.IOException;
import java.net.*;
public class SocketSend {
  public static void main(String args[]) throws IOException {
    sendData("localhost", "hello socket world");
  }

  public static void sendData(String host, String msg) throws IOException {
    Socket sock = new Socket( host, 256 );
    sock.getOutputStream().write(msg.getBytes());
    sock.getOutputStream().flush();
    sock.close();
  }
}

Python: import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 256))
sock.sendall("hello socket world") 
sock.close()
Task: Sockets
Java: import java.io.IOException;
import java.net.*;
public class SocketSend {
  public static void main(String args[]) throws IOException {
    sendData("localhost", "hello socket world");
  }

  public static void sendData(String host, String msg) throws IOException {
    Socket sock = new Socket( host, 256 );
    sock.getOutputStream().write(msg.getBytes());
    sock.getOutputStream().flush();
    sock.close();
  }
}

VB: Imports System
Imports System.IO
Imports System.Net.Sockets

Public Class Program 
    Public Shared Sub Main(ByVal args As String[])
        Dim tcp As New TcpClient("localhost", 256)
        Dim writer As New StreamWriter(tcp.GetStream())

        writer.Write("hello socket world")
        writer.Flush()

        tcp.Close()
    End Sub
End Class
Task: Sockets
Go: package main
 
import (
    "fmt"
    "net"
)
 
func main() {
    conn, err := net.Dial("tcp", "localhost:256")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer conn.Close()
    _, err = conn.Write([]byte("hello socket world"))
    if err != nil {
        fmt.Println(err)
    }
}

Python: import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 256))
sock.sendall("hello socket world") 
sock.close()
Task: Sockets
Go: package main
 
import (
    "fmt"
    "net"
)
 
func main() {
    conn, err := net.Dial("tcp", "localhost:256")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer conn.Close()
    _, err = conn.Write([]byte("hello socket world"))
    if err != nil {
        fmt.Println(err)
    }
}

VB: Imports System
Imports System.IO
Imports System.Net.Sockets

Public Class Program 
    Public Shared Sub Main(ByVal args As String[])
        Dim tcp As New TcpClient("localhost", 256)
        Dim writer As New StreamWriter(tcp.GetStream())

        writer.Write("hello socket world")
        writer.Flush()

        tcp.Close()
    End Sub
End Class
Task: Sockets
Python: import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 256))
sock.sendall("hello socket world") 
sock.close()

VB: Imports System
Imports System.IO
Imports System.Net.Sockets

Public Class Program 
    Public Shared Sub Main(ByVal args As String[])
        Dim tcp As New TcpClient("localhost", 256)
        Dim writer As New StreamWriter(tcp.GetStream())

        writer.Write("hello socket world")
        writer.Flush()

        tcp.Close()
    End Sub
End Class
Task: Sockets
C: #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

const char *msg = "hello socket world";

int main()
{
   int i, sock, len, slen;

   struct addrinfo hints, *addrs;  
   memset(&hints, 0, sizeof(struct addrinfo));
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
   
   if (0 == getaddrinfo("localhost", "256", &hints, &addrs))
   {
       sock = socket(addrs->ai_family, addrs->ai_socktype, addrs->ai_protocol);
       if ( sock >= 0 )
       {
           if ( connect(sock, addrs->ai_addr, addrs->ai_addrlen) >= 0 )
           {
               const char *pm = msg;
               do
               {
                  len = strlen(pm);
                  slen = send(sock, pm, len, 0);
                  pm += slen;
               } while ((0 <= slen) && (slen < len));
           }
           close(sock);
       }
       freeaddrinfo(addrs);
   }
}

Java: import java.io.IOException;
import java.net.*;
public class SocketSend {
  public static void main(String args[]) throws IOException {
    sendData("localhost", "hello socket world");
  }

  public static void sendData(String host, String msg) throws IOException {
    Socket sock = new Socket( host, 256 );
    sock.getOutputStream().write(msg.getBytes());
    sock.getOutputStream().flush();
    sock.close();
  }
}
Task: Sockets
C: #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

const char *msg = "hello socket world";

int main()
{
   int i, sock, len, slen;

   struct addrinfo hints, *addrs;  
   memset(&hints, 0, sizeof(struct addrinfo));
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
   
   if (0 == getaddrinfo("localhost", "256", &hints, &addrs))
   {
       sock = socket(addrs->ai_family, addrs->ai_socktype, addrs->ai_protocol);
       if ( sock >= 0 )
       {
           if ( connect(sock, addrs->ai_addr, addrs->ai_addrlen) >= 0 )
           {
               const char *pm = msg;
               do
               {
                  len = strlen(pm);
                  slen = send(sock, pm, len, 0);
                  pm += slen;
               } while ((0 <= slen) && (slen < len));
           }
           close(sock);
       }
       freeaddrinfo(addrs);
   }
}

Python: import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 256))
sock.sendall("hello socket world") 
sock.close()
Task: Sockets
C#: using System;
using System.IO;
using System.Net.Sockets;

class Program {
    static void Main(string[] args) {
        TcpClient tcp = new TcpClient("localhost", 256);
        StreamWriter writer = new StreamWriter(tcp.GetStream());

        writer.Write("hello socket world");
        writer.Flush();

        tcp.Close();
    }
}

Go: package main
 
import (
    "fmt"
    "net"
)
 
func main() {
    conn, err := net.Dial("tcp", "localhost:256")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer conn.Close()
    _, err = conn.Write([]byte("hello socket world"))
    if err != nil {
        fmt.Println(err)
    }
}
Task: Sockets
C#: using System;
using System.IO;
using System.Net.Sockets;

class Program {
    static void Main(string[] args) {
        TcpClient tcp = new TcpClient("localhost", 256);
        StreamWriter writer = new StreamWriter(tcp.GetStream());

        writer.Write("hello socket world");
        writer.Flush();

        tcp.Close();
    }
}

Python: import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 256))
sock.sendall("hello socket world") 
sock.close()
Task: Sockets
C: #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

const char *msg = "hello socket world";

int main()
{
   int i, sock, len, slen;

   struct addrinfo hints, *addrs;  
   memset(&hints, 0, sizeof(struct addrinfo));
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
   
   if (0 == getaddrinfo("localhost", "256", &hints, &addrs))
   {
       sock = socket(addrs->ai_family, addrs->ai_socktype, addrs->ai_protocol);
       if ( sock >= 0 )
       {
           if ( connect(sock, addrs->ai_addr, addrs->ai_addrlen) >= 0 )
           {
               const char *pm = msg;
               do
               {
                  len = strlen(pm);
                  slen = send(sock, pm, len, 0);
                  pm += slen;
               } while ((0 <= slen) && (slen < len));
           }
           close(sock);
       }
       freeaddrinfo(addrs);
   }
}

Go: package main
 
import (
    "fmt"
    "net"
)
 
func main() {
    conn, err := net.Dial("tcp", "localhost:256")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer conn.Close()
    _, err = conn.Write([]byte("hello socket world"))
    if err != nil {
        fmt.Println(err)
    }
}
Task: Sockets
C: #include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

const char *msg = "hello socket world";

int main()
{
   int i, sock, len, slen;

   struct addrinfo hints, *addrs;  
   memset(&hints, 0, sizeof(struct addrinfo));
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
   
   if (0 == getaddrinfo("localhost", "256", &hints, &addrs))
   {
       sock = socket(addrs->ai_family, addrs->ai_socktype, addrs->ai_protocol);
       if ( sock >= 0 )
       {
           if ( connect(sock, addrs->ai_addr, addrs->ai_addrlen) >= 0 )
           {
               const char *pm = msg;
               do
               {
                  len = strlen(pm);
                  slen = send(sock, pm, len, 0);
                  pm += slen;
               } while ((0 <= slen) && (slen < len));
           }
           close(sock);
       }
       freeaddrinfo(addrs);
   }
}

PHP: $socket = fsockopen('localhost', 256);
fputs($socket, 'hello socket world');
fclose($socket);
Task: Sockets
C#: using System;
using System.IO;
using System.Net.Sockets;

class Program {
    static void Main(string[] args) {
        TcpClient tcp = new TcpClient("localhost", 256);
        StreamWriter writer = new StreamWriter(tcp.GetStream());

        writer.Write("hello socket world");
        writer.Flush();

        tcp.Close();
    }
}

PHP: $socket = fsockopen('localhost', 256);
fputs($socket, 'hello socket world');
fclose($socket);
Task: Sockets
C++: 

#include <boost/asio.hpp>

int main()
{
  boost::asio::io_context io_context;
  boost::asio::ip::tcp::socket sock(io_context);
  boost::asio::ip::tcp::resolver resolver(io_context);
  boost::asio::ip::tcp::resolver::query query("localhost", "4321");

  boost::asio::connect(sock, resolver.resolve(query));
  boost::asio::write(sock, boost::asio::buffer("Hello world socket\r\n"));

  return 0;
}

PHP: $socket = fsockopen('localhost', 256);
fputs($socket, 'hello socket world');
fclose($socket);
Task: Sockets
Go: package main
 
import (
    "fmt"
    "net"
)
 
func main() {
    conn, err := net.Dial("tcp", "localhost:256")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer conn.Close()
    _, err = conn.Write([]byte("hello socket world"))
    if err != nil {
        fmt.Println(err)
    }
}

PHP: $socket = fsockopen('localhost', 256);
fputs($socket, 'hello socket world');
fclose($socket);