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 766263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T17:01:11+00:00 2026-05-14T17:01:11+00:00

I have a typical server in my end and a friend using a client

  • 0

I have a typical server in my end and a friend using a client to connect to my IP/Port and he consistently receives the exception: “A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond {MY_IP}:{MY_PORT}”—You don’t need to know my IP.

The client and server, however, work fine on the loopback address (127.0.0.1). I also do not have any firewall nor is windows firewall active.

Server:

static void Main(string[] args)
        {
            Console.Title = "Socket Server";
            Console.WriteLine("Listening for messages...");

        Socket serverSock = new Socket(
            AddressFamily.InterNetwork,
            SocketType.Stream,
            ProtocolType.Tcp);

        IPAddress serverIP = IPAddress.Any;
        IPEndPoint serverEP = new IPEndPoint(serverIP, 33367);

        SocketPermission perm = new SocketPermission(NetworkAccess.Accept, TransportType.Tcp, "98.112.235.18", 33367);
        serverSock.Bind(serverEP);
        serverSock.Listen(10);

        while (true)
        {
            Socket connection = serverSock.Accept();

            Byte[] serverBuffer = new Byte[8];
            String message = String.Empty;

            while (connection.Available > 0)
            {
                int bytes = connection.Receive(
                    serverBuffer,
                    serverBuffer.Length,
                    0);

                message += Encoding.UTF8.GetString(
                    serverBuffer,
                    0,
                    bytes);
            }

            Console.WriteLine(message);
            connection.Close();
        }
    }

Client:

static void Main(string[] args)
    {
        // Design the client a bit
        Console.Title = "Socket Client";

        Console.Write("Enter the IP of the server: ");
        IPAddress clientIP = IPAddress.Parse(Console.ReadLine());
        String message = String.Empty;

        while (true)
        {
            Console.Write("Enter the message to send: ");
            // The messsage to send
            message = Console.ReadLine();

            IPEndPoint clientEP = new IPEndPoint(clientIP, 33367);

            // Setup the socket
            Socket clientSock = new Socket(
                AddressFamily.InterNetwork,
                SocketType.Stream,
                ProtocolType.Tcp);

            // Attempt to establish a connection to the server
            Console.Write("Establishing connection to the server... ");
            try
            {
                clientSock.Connect(clientEP);

                // Send the message
                clientSock.Send(Encoding.UTF8.GetBytes(message));
                clientSock.Shutdown(SocketShutdown.Both);
                clientSock.Close();
                Console.Write("Message sent successfully.\n\n");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
  • 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-14T17:01:12+00:00Added an answer on May 14, 2026 at 5:01 pm

    Looks like it was an error on the client side with some firewall.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a typical business application with an Outlook-looking Winforms client talking to asmx
I have a working application that establishes an SSL connection to a server. The
I have this typical scenario. I have a smartclient application built on .net 2.0
Let's say you have a typical web app and with a file configuration.whatever. Every
It is typical to have something like this in your cshrc file for setting
We have 5mb of typical text (just plain words). We have 1000 words/phrases to
i have in the database typical tables like user, usergroup, and they have relations.
I have a data warehouse containing typical star schemas, and a whole bunch of
I have my resource and they typical overridden method to handle POST requests. public
I have a win form UI that looks like a typical calculator. Naturally I

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.