Hi. I have this connection code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
namespace ConnApp
    class Program
        static void Main(string[] args)
            Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint ip = new IPEndPoint(IPAddress.Parse(""), 1234);

It's telling me "Error!" and I cannot connect to local. But connection works on port 80. Please help me.

Recommended Answers

All 3 Replies

We need a lot more information than "it's telling me Error". What error, exactly, is it giving. What line, exactly, is the error occuring. You should catch specific exceptions, not the generic "catch" you are using. You don't even bother to get the exception object so you can see more information about the problem!

My error response, what I typed it in code - try catch.

I know, but that tells us nothing except there is an exception. Change your catch statement (and following code) to:

catch (Exception ex) {
    if (ex.InnerException != null) {
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.