Click here to Skip to main content
15,888,461 members
Home / Discussions / C#
   

C#

 
GeneralRe: CheckedListBox event handling strangeness Pin
Nick Parker29-Jul-04 8:01
protectorNick Parker29-Jul-04 8:01 
GeneralRe: CheckedListBox event handling strangeness Pin
James Kolpack29-Jul-04 8:31
James Kolpack29-Jul-04 8:31 
GeneralRe: CheckedListBox event handling strangeness Pin
James Kolpack29-Jul-04 11:12
James Kolpack29-Jul-04 11:12 
GeneralC# DataGrid - how to get the sort arrow in column header Pin
T J Manjaly29-Jul-04 5:03
sussT J Manjaly29-Jul-04 5:03 
GeneralColumn selection control needed Pin
Jan R Hansen29-Jul-04 4:38
Jan R Hansen29-Jul-04 4:38 
GeneralRe: Column selection control needed Pin
billb211229-Jul-04 4:52
billb211229-Jul-04 4:52 
GeneralRe: Column selection control needed Pin
Nick Parker29-Jul-04 5:33
protectorNick Parker29-Jul-04 5:33 
GeneralDns.GetHostByAddress problem Pin
Dave@keyspell29-Jul-04 4:12
sussDave@keyspell29-Jul-04 4:12 
Hi all

I have a problem with my program, I'm trying to send data between two computers. The problem is this, I can send data between the client app and server app (which is on my other computer, through wirless connection) as long as I specify the HostName i.e. "dave", then use the IPHostEntry.Resolve to get the ip address. I don't want to use the HostName as the app will run over the internet, so my client app sends it's ip address to the server, the server then try's to send data back to the client using the given ip address but gets stuck in a loop as it keeps sending itself the data not the client. When I had a look at the ip address the server was recieving it ok but when i had a look at the HostName that the server was producing from the ip address, it was refering to itself not the client.

Would this be anything to do with the fact that its over a local network and not the internet?

My Server Code is below:

TcpClient tcpc = new TcpClient();
int port = 5656;
string[] server = o.WhosOnline();
IPHostEntry IPHost;
string []aliases;
bool loggedin = false;
IPAddress[] addr;

bool success;
success = o.loguser(cmd[2].ToString());
//IPHost = Dns.Resolve("dave") <-- I DONT WANT TO USE THIS
IPHost = Dns.GetHostByAddress("192.168.0.1"); <-- I NEED SOMTHING LIKE THIS
Console.WriteLine("Host Name: " + IPHost.HostName); <-- DISPLAYS SERVER NAME
aliases = IPHost.Aliases;
Console.WriteLine(IPHost.AddressList[0].ToString()); <-- DISPLAYS CLIENTS IP
addr = IPHost.AddressList;
IPEndPoint ep = new IPEndPoint(addr[0], port);
tcpc.Connect(ep);
// Get the stream
Stream s = tcpc.GetStream();
StreamWriter r = new StreamWriter(s);
r.Write(stream);
r.Flush();
r.Close();
s.Close();
tcpc.Close();
Console.WriteLine("sent");

Can anyone help?
GeneralRe: Dns.GetHostByAddress problem Pin
Heath Stewart29-Jul-04 4:41
protectorHeath Stewart29-Jul-04 4:41 
GeneralRe: Dns.GetHostByAddress problem Pin
Dave@keyspell29-Jul-04 5:31
sussDave@keyspell29-Jul-04 5:31 
QuestionHow to Export to CSV file from DataSet? Pin
HyVong29-Jul-04 3:11
HyVong29-Jul-04 3:11 
AnswerRe: How to Export to CSV file from DataSet? Pin
Not Active29-Jul-04 4:13
mentorNot Active29-Jul-04 4:13 
AnswerRe: How to Export to CSV file from DataSet? Pin
Michael P Butler29-Jul-04 4:35
Michael P Butler29-Jul-04 4:35 
QuestionHow hard will it be to move to C# 2.0 ? Pin
Andres Coder29-Jul-04 3:02
Andres Coder29-Jul-04 3:02 
AnswerRe: How hard will it be to move to C# 2.0 ? Pin
SOCM_FP_CPP29-Jul-04 3:11
SOCM_FP_CPP29-Jul-04 3:11 
GeneralRe: How hard will it be to move to C# 2.0 ? Pin
Nick Parker29-Jul-04 5:07
protectorNick Parker29-Jul-04 5:07 
GeneralRe: How hard will it be to move to C# 2.0 ? Pin
SOCM_FP_CPP29-Jul-04 19:42
SOCM_FP_CPP29-Jul-04 19:42 
AnswerRe: How hard will it be to move to C# 2.0 ? Pin
Heath Stewart29-Jul-04 4:52
protectorHeath Stewart29-Jul-04 4:52 
GeneralTurning of the monitors Pin
PrebKlok29-Jul-04 3:01
PrebKlok29-Jul-04 3:01 
GeneralRe: Turning of the monitors Pin
Daniel Turini29-Jul-04 3:11
Daniel Turini29-Jul-04 3:11 
GeneralRe: Turning of the monitors Pin
PrebKlok29-Jul-04 3:31
PrebKlok29-Jul-04 3:31 
GeneralRe: Turning of the monitors Pin
Daniel Turini29-Jul-04 3:35
Daniel Turini29-Jul-04 3:35 
GeneralRe: Turning of the monitors Pin
PrebKlok29-Jul-04 4:18
PrebKlok29-Jul-04 4:18 
GeneralRe: Turning of the monitors Pin
Heath Stewart29-Jul-04 4:48
protectorHeath Stewart29-Jul-04 4:48 
GeneralRe: Turning of the monitors Pin
PrebKlok29-Jul-04 5:10
PrebKlok29-Jul-04 5:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.