[C#] Socket Programmin Problem menu

Shout-Out

User Tag List

Results 1 to 9 of 9
  1. #1
    Krillere's Avatar Contributor
    Reputation
    112
    Join Date
    Nov 2007
    Posts
    668
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C#] Socket Programmin Problem

    Hello, I'm trying to send some text between a server and a client. It works fine when I use it on 1 machine, but when I attempt to do send text between Computer 1 and Computer 2, it tells me this;
    No connection could be made because the target machine actively refused it.
    Server Connect code:
    Code:
    LstSck = new TcpListener(IPAddress.Any, 12345);
    LstSck.Start();
    Client Connect code:
    Code:
    IPAddress localAddr = IPAddress.Parse("127.0.0.1");
    int Port = 12345;
    IPEndPoint endPoint = new IPEndPoint(localAddr, port);
    I tried changing the IP in the client, but it didn't help.

    Yes, this is one of my first attempts at Socket programming, and yes, I fail at it.

    - Krillere

    [C#] Socket Programmin Problem
  2. #2
    The-Eradicator's Avatar Contributor

    Reputation
    149
    Join Date
    May 2007
    Posts
    829
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That error usually means the port isn't open.

    Are you running any firewalls?
    The most beautiful thing we can experience is the mysterious. It is the source of all true art and all science. He to whom this emotion is a stranger, who can no longer pause to wonder and stand rapt in awe, is as good as dead: his eyes are closed.
    Albert Einstein

  3. #3
    Krillere's Avatar Contributor
    Reputation
    112
    Join Date
    Nov 2007
    Posts
    668
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Firewall on both computers are down. I run the server first, and then the client, but the client never gets to the server. Which is weird, because it works when I use it on 1 computer, but bugs with 2 computer trying to connect to each other.

  4. #4
    Berusadeankan's Avatar Member
    Reputation
    11
    Join Date
    Dec 2007
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First thing's first, the IP. You'll need to set that to the IP adress the server is on. What errors do you get when doing that?

    And could we perhaps see abit of your code? Makes it alot easier

  5. #5
    Krillere's Avatar Contributor
    Reputation
    112
    Join Date
    Nov 2007
    Posts
    668
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, when I set it to my home IP, which I will not share, it still can't connect. I'll upload the source when I get home.

  6. #6
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're behind a router with NAT on(hopefully), so you don't want to use your external IP unless you're trying to connect over the internet. Your local IP should be 192.168.x.x

  7. #7
    Krillere's Avatar Contributor
    Reputation
    112
    Join Date
    Nov 2007
    Posts
    668
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I fixed it, just forgot to tell you. I found out that I could just use the: 192.168.1.100. So, thanks :-)

  8. #8
    Kirth's Avatar Active Member
    Reputation
    58
    Join Date
    Nov 2007
    Posts
    274
    Thanks G/R
    2/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    int Port = 12345;
    IPEndPoint endPoint = new IPEndPoint(localAddr, port);
    'Port' 'port', case sensitive.

  9. #9
    Krillere's Avatar Contributor
    Reputation
    112
    Join Date
    Nov 2007
    Posts
    668
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wrote it in the browser in about 5 seconds, it's just a typo. :-)

Similar Threads

  1. Problem with CE.
    By Eldretch in forum World of Warcraft General
    Replies: 1
    Last Post: 08-08-2006, 06:49 PM
  2. realm list problem
    By robtuner in forum World of Warcraft General
    Replies: 2
    Last Post: 07-21-2006, 09:08 AM
  3. I have problem with BHW 3.0
    By sunrize1 in forum World of Warcraft General
    Replies: 1
    Last Post: 07-17-2006, 08:49 AM
  4. wow emu problem
    By bezike in forum World of Warcraft General
    Replies: 0
    Last Post: 07-09-2006, 04:45 PM
  5. Site problems
    By Shanaar in forum Community Chat
    Replies: 10
    Last Post: 05-14-2006, 01:15 AM
All times are GMT -5. The time now is 12:43 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search