hey all. im in the process of creating a client/server app, ive just started and atm it simply acts like a whois client.
im trying to do something that seems very simple, but its turning out quite complicated. and i cant find any guides that suite what i need.
this is my code..
[delphi]
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using N = System.Net;
using System.Net.Sockets;
namespace ConsoleApplication1
{
public class Whois
{
static void Main(String[] args)
{
System.IO.TextReader r = System.IO.File.OpenText(@"E:\input.txt");
string s = r.ReadToEnd();
TcpClient client = new TcpClient();
client = new N.Sockets.TcpClient();
client.Connect("whois.godaddy.com", 43);
StreamWriter sw = new StreamWriter(client.GetStream());
StreamReader sr = new StreamReader(client.GetStream());
try
{
sw.WriteLine(args[0]);
sw.Flush();
}
catch
{
Console.WriteLine("ERROR: No User Specified");
}
Console.WriteLine(sr.ReadToEnd());
Console.ReadLine();
}
}
}
[/delphi]
basically, instead of having the "whois.godaddy.com" (the server address) in there, id like to be able to store it as a variable in a text file. so that i can change the server address without changing the source.
how do i do this?
ps. iv had to use delphi tags as i dont think we have c# tags.
im trying to do something that seems very simple, but its turning out quite complicated. and i cant find any guides that suite what i need.
this is my code..
[delphi]
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using N = System.Net;
using System.Net.Sockets;
namespace ConsoleApplication1
{
public class Whois
{
static void Main(String[] args)
{
System.IO.TextReader r = System.IO.File.OpenText(@"E:\input.txt");
string s = r.ReadToEnd();
TcpClient client = new TcpClient();
client = new N.Sockets.TcpClient();
client.Connect("whois.godaddy.com", 43);
StreamWriter sw = new StreamWriter(client.GetStream());
StreamReader sr = new StreamReader(client.GetStream());
try
{
sw.WriteLine(args[0]);
sw.Flush();
}
catch
{
Console.WriteLine("ERROR: No User Specified");
}
Console.WriteLine(sr.ReadToEnd());
Console.ReadLine();
}
}
}
[/delphi]
basically, instead of having the "whois.godaddy.com" (the server address) in there, id like to be able to store it as a variable in a text file. so that i can change the server address without changing the source.
how do i do this?
ps. iv had to use delphi tags as i dont think we have c# tags.