|
Hi,
I am using the following code to read the port number from xml file and send as a parameter to UdpClient.It works well. p1.xml file is stored in C:\projects\ports\10000...Simliarly i have stored p2.xml file in C:\projects\ports\10001 folder.p2.xml contains the port number 10001.
When the client clicks the C:\projects\ports\10000 path the exe in this path opens and communicates with the client by accepting the port 10000 from p1.xml.I am done with this step.
Suppose if the client clicks C:\projects\ports\10001 the exe opens .But now it should now accept the port as 10001 from p2.xml and do the communication with the client.Likewise for other ports also.
Please give me your ideas.
XmlTextReader xt = new XmlTextReader("p1.xml");
int p1=0;
while (xt.Read())
{
switch (xt.NodeType)
{
case XmlNodeType.Text:
String rv = xt.Value;
p1 = Convert.ToInt32(rv);
break;
}
}
listBox6.Items.Add("Connecting....");
UdpClient client = new UdpClient("127.0.0.1",p1);
|
|
|
|
|
Hi
I had a try with array of the port values. I have used an index that maps the directories to ports.I am stuck at a point.Since i am using the for loop it works well for i=0. i=1 should not execute before the server at C:\projects\ports\10001 starts.How can change this?Is there any loop construct that could help me perform this task?i should get incremented and do the same after the 2nd server starts.Can you please give your suggestions.I tried with break but still im not getting it right.
int[] a = new int[2];
XmlTextReader xtr1 = new XmlTextReader("p1.xml");
XmlTextReader xtr2 = new XmlTextReader("p2.xml");
int p1=0,p2=0;
while (xtr1.Read())
{
switch (xtr1.NodeType)
{
case XmlNodeType.Text:
String rv = xtr1.Value;
p1 = Convert.ToInt32(rv);
break;
}
}
while (xtr2.Read())
{
switch (xtr2.NodeType)
{
case XmlNodeType.Text:
String rv1 = xtr2.Value;
p2 = Convert.ToInt32(rv1);
break;
}
}
a[0] = p1;
a[1] = p2;
listBox6.Items.Add("Connecting....");
for (int i = 0; i <= 1; i++)
{
UdpClient client = new UdpClient("127.0.0.1", a[i]);
listBox6.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"), a[i]);
int n = client.Send(data, data.Length);
listBox6.Items.Add("Sent...");
listBox6.Items.Add("Message received from {0}:");
listBox6.Items.Add(ipep.ToString());
Byte[] received = new Byte[512];
received = client.Receive(ref ipep);
String dataReceived = System.Text.Encoding.ASCII.GetString(received);
listBox6.Items.Add(dataReceived);
|
|
|
|
|
how to do remote access of pc through internet using C#.how to transfer data.
|
|
|
|
|
did you read these "How to" questions somewhere or they just came in your mind. Well, first "How to" question is "How to use google ?". You just need to type www.google.com as you did for codeproject.com then type question you want as you wrote here. Simple...no ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi Experts
I am Varun.G , a Programmer.
I am stuck in a problem,thats y i make this question here..
I'll tell you in detail.
1.I made a software in .net 2005
2.It converts the data to an unknown format(though it is proper result of the software)
3.I created a new thread on making a new file extension for my
own software.(let call that as, .ass(as in mtb.ass).
4.isssue is ,how to associate these ,".ass" files in a purticular system with my software.
5.How to make the default application for these file types is my application.
EXPECT WISE REPLY..PLEASE...
THANX IN ADVANCE
|
|
|
|
|
Here[^] is an article.
जय हिंद
modified on Saturday, March 21, 2009 7:06 AM
|
|
|
|
|
d@nish wrote: It is done using FileAssociationInfo.
Its not inbuilt
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
corrected.
जय हिंद
|
|
|
|
|
|
I have written following code.
I have selected Project type as Visual C# -->
Smart Devise --> Windows CE 5.0
When i built the solution i am getting error as
"'System.Windows.Forms.Application' does not contain a definition for 'Idle'"
int counter = 0;
private void Form1_Idle(object sender, System.EventArgs e)
{
counter++;
label1.Text = counter.ToString();
}
private void Form1_Load(object sender, System.EventArgs e)
{
Application.Idle +=new EventHandler(Form1_Idle);
}
how to handle Idle event.
thanks
|
|
|
|
|
Just add..
private void Form1_Idle(object sender, EventArgs e)<br />
{<br />
}
Kelvin
|
|
|
|
|
saksp wrote: I have selected Project type as Visual C# -->
Smart Devise --> Windows CE 5.0
The .NET Compact Framework doesn't support the Application.Idle event. It is only supported by the .NET Framework.
|
|
|
|
|
Any one know an easy way to add a media player to a c# web form? Also, how do you play music on the login page?
|
|
|
|
|
Jahmelon wrote: c# web form
C# webform? What do you mean by that?
|
|
|
|
|
The form that serves as a basis for constructing a web page in c#
|
|
|
|
|
make an SRC statement
that may help you.
embed src="your file name,which you want to play" width="75%" height="500"% autoplay="true"></embed>
hope it work
|
|
|
|
|
hi i need a help for how i convert all excel sheet data in sql as a table
i have 800 records in 1 sheet.need only logic behind that
|
|
|
|
|
Use OLEDB and read data from excel. Loop through the records and insert each row into DB table. If your DB is SQL server, you can use SQLBulkCopy[^] as well.
|
|
|
|
|
i am using sql 2005 server
|
|
|
|
|
please send me key in the project stegnography for data hiding in midisongs and how to run it. the project download form the site code poject .com
|
|
|
|
|
|
Hi,
I am trying to come to grips with Vista UAC and am having problems understanding the following....
My installer software (InstallAware) uses $ALLAPPDATA$ as a pointer to the environment variable 'common user data' which prior to Vista was c:\documents and settings\all users\application data\program name etc' . In Vista it becomes 'c:\programdata\program name etc'.
The installer installs all the data files in either Vista and XP etc OK but when the user runs my program in Vista, my program says it can't access the data files. Disabling the UAC fixes the problem.
I specifically use InstallAware to set permissions for all users to have read write access to the $ALLAPPDATA$ folder.
Can someone tell me what I am missing?
Thanks...
Glen Harvy
|
|
|
|
|
You might be missing a few Vista rants
Anyway, turning UAC off solves the problem, so, the solution is turning UAC off. What do you need it for anyway?
|
|
|
|
|
harold aptroot wrote: What do you need it for anyway?
When someone downloads my program to test it out, the last thing I want them to have to do is send me an email saying - it doesn't work
I would think many would just uninstall it and I've lost a sale.
If I know my program doesn't work then I need to tell my users how to bypass/fix the problem or fix it myself. I don't want to tell my prospective client that MS doesn't know what it is doing in regards to the UAC and please turn it off. What are they going to think about me
Glen Harvy
|
|
|
|
|
Ok well fortunately a program can request admin privileges - but I think it has to be restarted for that. It'll throw an UAC prompt of course but everyone always clicks OK anyway.
|
|
|
|