Click here to Skip to main content
15,881,092 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to check if a file is encrypted Pin
Dave Kreskowiak8-Apr-09 5:23
mveDave Kreskowiak8-Apr-09 5:23 
GeneralRe: How to check if a file is encrypted Pin
Russell Napier8-Apr-09 5:26
Russell Napier8-Apr-09 5:26 
GeneralRe: How to check if a file is encrypted Pin
Luc Pattyn8-Apr-09 5:33
sitebuilderLuc Pattyn8-Apr-09 5:33 
GeneralRe: How to check if a file is encrypted Pin
Russell Napier8-Apr-09 5:36
Russell Napier8-Apr-09 5:36 
GeneralRe: How to check if a file is encrypted Pin
Dan Neely8-Apr-09 5:52
Dan Neely8-Apr-09 5:52 
QuestionPicture compression Pin
yasa8-Apr-09 4:33
yasa8-Apr-09 4:33 
AnswerRe: Picture compression Pin
Luc Pattyn8-Apr-09 5:29
sitebuilderLuc Pattyn8-Apr-09 5:29 
QuestionClient Server Pin
mrithula88-Apr-09 4:23
mrithula88-Apr-09 4:23 
Hi I have used the following code for the client server communication.The start() starts the server and calls the SenMessage() to send the message to the server.This method takes as input the port number of the server that has started.

It works fine.Suppose i start 2 servers, then both servers are calling the SendMessage().In this case one server communicates properly.For the 2nd one it says that the existing connection is closed.

I think that when the 2nd server starts it should call the sendMessage() with some time delay.I hope that it work then.But im not sure how to do it.Please help me with this.<pre>private void Start_Click(object sender, EventArgs e)
{
//int n;
//label1.Text = "Enter the value of n:";
String n2, n1, n3, n4;
n1 = lb4.Text;
n2 = lb5.Text;
n3 = lb6.Text;
n4 = lb7.Text;
ProcessStartInfo si1,si2,si3,si4;

if (cb.Checked && lb4.Text!="")
{

si1 = new ProcessStartInfo(n1);
proc = Process.Start(si1);
proclist.Add(proc);
String portno1 = n1.Substring(18, 5);
listBox1.Items.Add(portno1);
pno1=Convert.ToInt32(portno1);
SendMessage(pno1);
}
if (cb1.Checked && lb5.Text!="")
{
n2 = lb5.Text;
si2 = new ProcessStartInfo(n2);
proc = Process.Start(si2);
proclist.Add(proc);

String portno2 = n2.Substring(18, 5);
int pno2 = Convert.ToInt32(portno2);
SendMessage(pno2);
}
}

public void SendMessage(int portnumber)
{

try
{
UdpClient client = new UdpClient("127.0.0.1", portnumber);
listBox2.Items.Add("Connected");
Byte[] data = new Byte[256];
String snd = "hello";
data = Encoding.ASCII.GetBytes(snd);
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), portnumber);
int n = client.Send(data, data.Length);
listBox2.Items.Add("Sent...");
listBox2.Items.Add("Message received from {0}:");
listBox2.Items.Add(ipep.ToString());
Byte[] received = new Byte[512];
received = client.Receive(ref ipep);
String dataReceived = System.Text.Encoding.ASCII.GetString(received);
listBox2.Items.Add(dataReceived);

client.Close();

//}
}
catch (Exception e)
{
listBox2.Items.Add("An Exception Occurred!");
listBox2.Items.Add(e.ToString());
}


}
QuestionProblem with SQL-Server Date Query Pin
der.flori8-Apr-09 4:08
der.flori8-Apr-09 4:08 
AnswerRe: Problem with SQL-Server Date Query Pin
Dino Mulahusic8-Apr-09 4:12
professionalDino Mulahusic8-Apr-09 4:12 
GeneralRe: Problem with SQL-Server Date Query Pin
der.flori8-Apr-09 4:21
der.flori8-Apr-09 4:21 
GeneralRe: Problem with SQL-Server Date Query Pin
Searril8-Apr-09 4:29
Searril8-Apr-09 4:29 
GeneralRe: Problem with SQL-Server Date Query Pin
Dino Mulahusic8-Apr-09 4:30
professionalDino Mulahusic8-Apr-09 4:30 
GeneralRe: Problem with SQL-Server Date Query Pin
der.flori8-Apr-09 4:41
der.flori8-Apr-09 4:41 
GeneralRe: Problem with SQL-Server Date Query Pin
Dave Kreskowiak8-Apr-09 4:58
mveDave Kreskowiak8-Apr-09 4:58 
GeneralRe: Problem with SQL-Server Date Query Pin
PIEBALDconsult8-Apr-09 5:17
mvePIEBALDconsult8-Apr-09 5:17 
QuestionVerification class Pin
Wheels0128-Apr-09 3:33
Wheels0128-Apr-09 3:33 
AnswerRe: Verification class Pin
Jimmanuel8-Apr-09 3:41
Jimmanuel8-Apr-09 3:41 
GeneralRe: Verification class Pin
Wheels0128-Apr-09 3:44
Wheels0128-Apr-09 3:44 
GeneralRe: Verification class Pin
Jimmanuel8-Apr-09 3:52
Jimmanuel8-Apr-09 3:52 
Questionprinting a dataTable or data from datagridview Pin
laziale8-Apr-09 2:56
laziale8-Apr-09 2:56 
AnswerRe: printing a dataTable or data from datagridview Pin
musefan8-Apr-09 3:16
musefan8-Apr-09 3:16 
AnswerRe: printing a dataTable or data from datagridview Pin
MNantu8-Apr-09 4:25
MNantu8-Apr-09 4:25 
QuestionString contained within string Pin
kanchoette8-Apr-09 2:56
kanchoette8-Apr-09 2:56 
Answercontained Pin
Luc Pattyn8-Apr-09 3:15
sitebuilderLuc Pattyn8-Apr-09 3:15 

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.