|
I think the Connect method of TcpClient, or rather the overload you're using requires the Server's hostname, as opposed to its IP as a string.
So try
tcpclnt.Connect("YourServerName",8006);
Worked for me ;>
Or use a different overload of the Connect method.
I need to investigate a bit further into that, cos this stuff is great!
var question = (_2b || !(_2b));
|
|
|
|
|
Hi
how is that i can find the server's hostname?
|
|
|
|
|
OK.
If you don't know the computer's name, try this:
byte[] zb = { 192, 168, 0, 5 };
System.Net.IPAddress ipa = new System.Net.IPAddress(zb);
System.Net.IPEndPoint Ipep = new System.Net.IPEndPoint(ipa, 8006);
TcpClient tcpCl = new TcpClient();
tcpCl.Connect(Ipep);
I just figured you would have known your server's name, that's all.
But this works just as well (if not better).
var question = (_2b || !(_2b));
|
|
|
|
|
Perhaps you could post the actual exception.
Often e.Source and e.Message are useful as well as the e.StackTrace.
I have no problem using:
myClient.Connect("xxx.xxx.xxx.xxx", port);
in my current project. I'm using UdpClients but the overloads for .Connect are the same.
---------------------------------------------
Help... I'm embedded and I can't get out!
If they don't get the basic research and learning skills down then they'll end up having a very hard life (Either that or they'll become managers) - Micheal P Butler
|
|
|
|
|
|
Dear Yesu Prakash,
After reading your post I think I could give you the anwsers on your questions.
Question 1: I need to develop in C#?
What you mean is probably: do I need to develop this in C#?
The anwser is yes. Because if you use another language for example Java, you are betraying Microsoft and this would mean people won't like you in these forums. There is also a possibility to use Assembly, which I would prefer, because this is simple and plain. You can talk directly to the ports of the computer, so it would be easy to send your bits there.
Question 2: How can I start development?
Simple: open notepad and do your thing
Question 3: What is the idea behind voice conference?
If I understand your question (which I doubt) I would say the idea behind voice conference is hearing people which are not in your room. That you can talk to people over the computer, maybe even the internet. This is just for easy communication.
Question 4: What are the alternative ways?
Alternative ways are as following:
1. in stead of starting your computer (and waste the environment) you could just go out for a walk, walk to the friend you would like to speak and knock on his door
2. You could take the bike or car
3. You could pay people money to make such an app for you
4. You could ask this question on another forum
....
As we say in Holland: there are many ways which will lead to Rome... this means that there's always another way to do your thing.
Well good luck and I hope you understand that half of my post is sarcasme.
modified on Monday, February 23, 2009 7:56 AM
|
|
|
|
|
Deresen wrote: 1. in stead of starting your computer (and waste the environment) you could just go out for a walk, walk to the friend you would like to speak and knock on his door
2. You could take the bike or car
3. You could pay people money to make such an app for you
4. You could ask this question on another forum
Epic fail, you totally forgot the cell or telephone. don't forget, videotaping your message and mailing it to the recipient.
|
|
|
|
|
if you dont know the answer then shut up man..
i guess u can answer the following doubts...
1. plese help me to write code for adding two integers..
2. concatenate string "hello" and "world"..
i am expecting your valuable help asap
thankyou
|
|
|
|
|
I'm sincerely sorry mister Yesu....
You should be the one thinking about your questions, not just wasting your energy blaming other which didn't give the anwser you expected.
I gave you the anwsers on your questions, not really seriously, but nobody else could've done it better, because you didn't explain what you really wanted to do.
Again: if you would like some good anwsers, then please make sense with asking questions.
the anwser on question 2 is to hard for me, I really don't know how to do this .... but the two integers isn't really tough:
int myFirstNumberWhichIsFarToLong, secondNr;
myFirstNumberWhichIsFarToLong = 4;
secondNr = 5;
int outcome = 0;
outcome = myFirstNumberWhichIsFarToLong * secondNr;
for(int i = 0; i < myFirstNumberWhichIsFarToLong - 2; i++)
{
outcome -= (myFirstNumberWhichIsFarToLang * secondNr);
}
outcome += myFirstNumberWhichIsFarToLong;
Console.out.WriteLine("oucome should be 9: " + outcome);
This will only work when the first integer is 2 or higher and the second is 0 or higher.
Good luck
|
|
|
|
|
|
Hi guys,
Hi guys, I am implementing a download cache engine for my application. When I read that the file's LastModified is not newer than my local file, I do not download the file: When I first downloaded the file, I set the file date to the LastModified date from the response. If I request to download the same file in same session in the application again, it takes a long time in the HttpWebRequest's GetResponse() or may fail eventually in timeout.
I did close the response before proceeding on. And I set the HttpWebRequest's KeepAlive to false.
Any solutions or workaround?
Thank you in advance!
|
|
|
|
|
Sounds like your clearing up properly, but GetResponse() will hang if you don't dispose of the stream on subsequent calls.
Regards,
Rob Philpott.
|
|
|
|
|
hi guys i am using a c# class file in asp.net this class file is rsacryptography class file for encoding and decoding
here is the class file
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO;
using System.Collections;
namespace Cryptography
{
public class AsymmetricCryptography
{
// Fields
private string pk;
private string prk;
// Methods
public AsymmetricCryptography()
{
RSACryptoServiceProvider provider = new RSACryptoServiceProvider(0x400);
this.prk = provider.ToXmlString(true);
this.pk = provider.ToXmlString(false);
}
public static string Decript(string Decript_Text, string Private_Key)
{
string str = Decript_Text;
string str2 = "";
string xmlString = Private_Key;
RSACryptoServiceProvider provider = new RSACryptoServiceProvider();
// RSAParameters parameters = new RSAParameters();
provider.FromXmlString(xmlString);
string str4 = "";
Queue queue = new Queue();
while (str.Length != 0)
{
if (provider.KeySize == 0x400)
{
str4 = str.Substring(0, str.IndexOf("=") + 1);
queue.Enqueue(str4);
str = str.Remove(0, str4.Length);
}
else
{
str4 = str.Substring(0, str.IndexOf("==") + 2);
queue.Enqueue(str4);
str = str.Remove(0, str4.Length);
}
}
queue.TrimToSize();
int count = queue.Count;
for (int i = 1; i <= count; i++)
{
str4 = (string)queue.Dequeue();
ERROR str2 = str2 + Encoding.ASCII.GetString(provider.Decrypt(Convert.FromBase64String(str4), true));
}
return str2;
}
public static string Encript(string Plain_Text, string Public_Key)
{
string str = Plain_Text;
string xmlString = Public_Key;
string str3 = "";
RSACryptoServiceProvider provider = new RSACryptoServiceProvider();
//RSAParameters parameters = new RSAParameters();
provider.FromXmlString(xmlString);
int num = (str.Length / 0x20) + 1;
char[] chars = str.ToCharArray();
byte[][] bufferArray = new byte[num][];
int index = 0;
for (int i = 1; i <= num; i++)
{
if (i == num)
{
bufferArray[i - 1] = Encoding.ASCII.GetBytes(chars, index, chars.Length - index);
}
else
{
bufferArray[i - 1] = Encoding.ASCII.GetBytes(chars, index, 0x20);
index += 0x20;
}
}
string str4 = str;
for (int j = 0; j < bufferArray.Length; j++)
{
str3 = str3 + Convert.ToBase64String(provider.Encrypt(bufferArray[j], true));
}
return str3;
}
// Properties
public string Private_Key
{
get
{
return this.prk;
}
set
{
if (value != null)
{
this.prk = value;
}
}
}
public string Public_Key
{
get
{
return this.pk;
}
set
{
if (value != null)
{
this.pk = value;
}
}
}
}
public class HashCalculate
{
// Methods
public HashCalculate()
{}
public static string HashMD5(byte[] file)
{
MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
byte[] buffer = file;
byte[] inArray = provider.ComputeHash(buffer);
provider.Clear();
return Convert.ToBase64String(inArray);
}
}
public class SymetricCryptography
{
public SymetricCryptography()
{
}
// Fields
private SymmetricAlgorithm mCSP = new DESCryptoServiceProvider();
// Methods
public byte[] DecryptFile(byte[] file)
{
ICryptoTransform transform = this.mCSP.CreateDecryptor(this.mCSP.Key, this.mCSP.IV);
byte[] buffer = file;
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
stream2.Close();
return stream.ToArray();
}
public string DecryptString(string Value)
{
ICryptoTransform transform = this.mCSP.CreateDecryptor(this.mCSP.Key, this.mCSP.IV);
byte[] buffer = Convert.FromBase64String(Value);
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
stream2.Close();
return Encoding.UTF8.GetString(stream.ToArray());
}
public byte[] EncryptFile(byte[] file)
{
ICryptoTransform transform = this.mCSP.CreateEncryptor(this.mCSP.Key, this.mCSP.IV);
byte[] buffer = file;
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
stream2.Close();
return stream.ToArray();
}
public string EncryptString(string Value)
{
ICryptoTransform transform = this.mCSP.CreateEncryptor(this.mCSP.Key, this.mCSP.IV);
byte[] bytes = Encoding.UTF8.GetBytes(Value);
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(bytes, 0, bytes.Length);
stream2.FlushFinalBlock();
stream2.Close();
return Convert.ToBase64String(stream.ToArray());
}
public string Initialization_Vector
{
get
{
this.mCSP.GenerateIV();
return Convert.ToBase64String(this.mCSP.IV);
}
set
{
if (value != null)
{
this.mCSP.IV = Convert.FromBase64String(value);
}
}
}
public string Sessio_Key
{
get
{
this.mCSP.GenerateKey();
return Convert.ToBase64String(this.mCSP.Key);
}
set
{
if (value != null)
{
this.mCSP.Key = Convert.FromBase64String(value);
}
}
}
}
}
this is the class file error is in this line
str2 = str2 + Encoding.ASCII.GetString(provider.Decrypt(Convert.FromBase64String(str4), true));
so guys plz help me to get out of this problems
with regards
venkatesh
|
|
|
|
|
Hello Friends ,
How to retrieve image from database (sqlserver 2005) to imabe button,
I cannot get image ,
here is the Code :
{
string t;
t = Session["id"].ToString();
adp = new SqlDataAdapter(" select myname ,gender ,dateofbirth ,aboutme,activities,Favouriteblogs,books... from registrations where username='"+t+"'", con);
adp.Fill(ds);
ImageButton1.ImageUrl = ds.Tables[0].Rows[0][6].ToString();
// ImageButton1.ImageUrl = Server.MapPath("./picturs/general/" & a)
DetailsView1.DataSource = ds;
DetailsView1.DataBind();
}
<div class="ForumMod">modified on Monday, February 23, 2009 5:56 AM</div>
|
|
|
|
|
How do you store the image in db? as a string or bytes?
Calin
|
|
|
|
|
Helloo sir,
columname photo
datatype varchare(50)
|
|
|
|
|
and you keep the image name or url in photo column?
From what I can see, you are not returning the photo column in your query.
Calin
|
|
|
|
|
hi
I want to connect to a sqlserver instance on another computer in the workgroup network.
my program is win application with c# VS.NET 2008 and SQL Server 2000.
what settings are needed for my sqlserver instance and my application?
can you help me?
H.R
|
|
|
|
|
Do you want to Access the SQL Database or you just want a remote Connection ?
if you want to access the Database i dont think your Connection String will change, it will still be Normal , or are you asking how your Connection string look like ?
"User id=SA;Password=oops;Server=myremoteserver;Database=mydb"
Please be Clear
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
no need setting.
you should give win application's server name with SQl Server 2000 computer'computer name.
|
|
|
|
|
i want to know reporting.
|
|
|
|
|
you should be learn crystal report
|
|
|
|
|
or Reporting Services (ReportViewer,...)
|
|
|
|
|
This code works....
private void toolStripButton1_Click_1(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
try
{
// Set Processing Mode
reportViewer1.ProcessingMode = ProcessingMode.Local;
// Set RDL file
reportViewer1.LocalReport.ReportPath = (Application.StartupPath + "\\reports\\trdReport.rdlc");
// Supply a DataTable corresponding to each report data source
reportViewer1.LocalReport.DataSources.Add(
new ReportDataSource("getTrends", LoadData()));
// Add the reportviewer to the form
reportViewer1.Dock = DockStyle.Fill;
// Process and render the report
reportViewer1.RefreshReport();
}
catch (Exception ex)
{
StreamWriter writer = new StreamWriter(logFile, true, System.Text.Encoding.ASCII);
writer.WriteLine(System.DateTime.Now);
writer.WriteLine("[generate report]");
writer.WriteLine("[generate report]");
writer.WriteLine(ex);
writer.WriteLine("\r");
writer.Close();
MessageBox.Show(ex.ToString());
//this.Close();
//System.Environment.Exit(0);
}
this.Cursor = Cursors.Default;
}
private DataTable LoadData()
{
// Load data from XML file
DataSet ds = new DataSet();
string myFilePath = (Application.StartupPath + "\\bin\\" + "trd.xml");
ds.ReadXml(myFilePath);
return ds.Tables[0];
}
tia
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
I need to add reference to com object in run time.
I don't know witch com object i need in compile time.
Actually i need to choose between 2 com objects that i need to load.
I know those 2 object GUID - but i need to check in run time witch com object install on current machine and then load the right object.
How to do it ?
Thanks for the help.
|
|
|
|
|