|
Hello all,
here i am facing some problem in implementing tcp/ip in my web space.
The application is like this.
In the web space, server program has to be executed which listens for the tcp clients. Once we connect to the corresponding server ip and port number from client, server has to accept the client and display the messages sent from the client.
Now the problem is
though i connect from the client by specifying approproiate server ip and port number, server is unable to accept it.
The code i have used in the server program is as follows.
Int32 port = pno;
IPAddress localAddr = IPAddress.Parse("<server ip>");
server = new TcpListener(localAddr, port);
server.Start();
while (true)
{
client = server.AcceptTcpClient();
}
Plese let me know if i am doing any thing wrong here.
I can provide any other information if required.
PS: the same thing in working in LAN
Thanks in advance.
|
|
|
|
|
Hi,
how does you know that the "server is unable to accept" the request? Do you receive an error message? If yes, please provide more information about this.
If it is working within the LAN, maybe it is a firewall problem? Maybe the server is not accepting requests on the port specified.
Regards
Sebastian
|
|
|
|
|
Good Morning guys,
I will need your help on this. i have Backups on a Folder on my C drive on this Path with a .BAK file extension and i want to restore them.
"C:\DATABASE\"
Now i want to go to the Folder and look for all the File names and Display them in the DropDownlist. Am doing this for a ASP.NET Page. i thought it would post it here , because its C# type of question.
Thank you
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
vuyiswam@its.co.za
|
|
|
|
|
This should do it:
Directory.GetFiles(@"c:\database").ToList().ForEach(n => TheDrowDown.Items.Add(Path.GetFileName(n));
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi Guffa
i have not done IO before. So what is the name space ? Does this code supposed to be on one line ? If so i get Errors.
The "Tolist() " is not recognised,
The Foreach not working
.ForEach(n => cmbrestore.Items.Add(Path.GetFileName(n)); <br />
Thanks
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
vuyiswam@its.co.za
|
|
|
|
|
Vuyiswa Maseko wrote: i have not done IO before. So what is the name space ?
System.IO.
Vuyiswa Maseko wrote: Does this code supposed to be on one line ?
Yes. However, C# is not a line based language, so you can write it in several lines if you like.
Vuyiswa Maseko wrote: The "Tolist()" is not recognised,
The Foreach not working
You need framework 3.5 for those. If you don't have that you have to loop through the names some other way.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi Guffa
Thanks , i Found a Solution
DirectoryInfo dir = new DirectoryInfo(@"C:\DATABASES\");
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
cmbrestore.Items.Add(Convert.ToString(file));
}
Thank you
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
vuyiswam@its.co.za
|
|
|
|
|
You don't need framework 3.5 for ForEach, I guess it's just lambda statement that causes error. anonymous method will work.
|
|
|
|
|
Giorgi Dalakishvili wrote: You don't need framework 3.5 for ForEach
That's right, but you need 3.5 for the ToList method.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I am trying to add a Arraylist, as a member to another array list.
The problem is, All the members of GroupReqAL are contain the final values of ReqAL. When I debug, first run is fine, in the 2 nd run the ReqAL is added both GroupReqAL[0] and GroupReqAL[1] are set to the latest values of ReqAL and in the 3 rd run GroupReqAL[0] ,GroupReqAL[1],GroupReqAL[2] are set to the latest values of ReqAL... and soon, finally all the members of GroupReqAL containts the latest values of ReqAL. Please advice
int i=0;
int j=0;
ArrayList GroupReqAL=new ArrayList();
ArrayList ReqAL=new ArrayList();
while(i<100)
{
while(j<10)
{
ReqAL.Add(j*i);
j++;
}
GroupReqAL.Add(ReqAL);
i++;
}
|
|
|
|
|
That's because you are adding a reference to the same ArrayList over and over again. If you want to add references to separate ArrayList instances, you have to create a new ArrayList each time.
Unless you are stuck with framework 1 you shouldn't use the ArrayList class at all. Use the generic List<T> class.
Despite everything, the person most likely to be fooling you next is yourself.
modified on Friday, January 16, 2009 6:16 AM
|
|
|
|
|
Hello everyone,
i have button in application when user double click the button the string value show in richtextbox.but how???
here is my code:-
private void MainXmlStart_MouseDoubleClick(object sender, MouseEventArgs e)
{
richTxt.Text = "\nn<book xml:lang="\" en-us\""="">";
richTxt.Focus();
}
Please give me idea...???
where is a mistake...!!
Thanks,
Amit
|
|
|
|
|
Doubleclick event does not fire for button. It is because ControlStyles.StandardDoubleClick property is set to false. In order to fire the double click event, you will need to create your own button by inheriting the button and setting ControlStyles.StandardClick and ControlStyles.StandardDoubleClick to true. This can be done using SetStyle method.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
hi ,all
a easy case,
year month day
1999 12 2
2000 8 9
2001 9 9
how can i use
listview1.Item.Add(listviewitem) ?
thanks~~~
|
|
|
|
|
Hi,
what I normally do with listview-items is to create a derived class from ListViewItem, passing the object to display to the constructor and building all subitems within a method called from the constructor.
class MyListViewItem:ListViewItem {
public MyListViewItem(DateTime dtDate):base(String.Empty) {
this.BuildItem(dtDate);
}
private void BuildItem(DateTime dtDate) {
this.SubItems.Add(dtDate.Year);
this.SubItems.Add(dtDate.Month);
this.SubItems.Add(dtDate.Day);
}
}
Then I can use objects from this class to add them to the ListView:
listview1.Items.Add(new MyListViewItem(DateTime.Now));
Look at the following link to get an idea for SubItems
http://msdn.microsoft.com/de-de/library/system.windows.forms.listviewitem(VS.80).aspx[^].
Let me know if this helps you.
Regards
Sebastian
P.S.: The code of MyListViewItem is just an example. Within the BuildItem-method you must take care of already existing subitems etc. (Be sure that the ListView is in "Detail"-View mode.)
|
|
|
|
|
Dear SeMartens,
I'm very glad to received your message,
Thank you for your advice. It is so helpful to me.
my MSN is lebron_y@126.com
and my E-mail is lebron_y@126.com ,too.
make a friend...
Regard
lincyang
|
|
|
|
|
Hi,
I want to implement kerberos authentication in an asp.net web application. This has to be done without using WSEs. Please help me out...
A sample project can help me out.
Thanks in advance!!
|
|
|
|
|
Hi,
I am using this code for downloading a file.Can anybody tell how to use it without showing save as option:-
Response.ContentType = "text/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + ViewState["Name"].ToString() + ".pdf");
Thread.Sleep(5000);
Response.TransmitFile(sfilepath);
Response.End();
Thanks
|
|
|
|
|
tauras81 wrote: without showing save as option:-
That is not possible as it is controlled by the browser.
|
|
|
|
|
Hello,
u can try out with DownloadFile() method.
for this u need to include namspace System.Net
then u can try out as
WebClient objWebClient = new WebClient();
objWebClient.DownloadFile(URI, targetfilename);
Check this hope it helps
Regards,
ashok
ashok
|
|
|
|
|
I think the above solution will solve your problem only when you are using this in a windows application.where webclient will act as intermediate browser and handle the request and target filename will be obviously a local path in your system to which you will be having access.
But if the requirement is like you have to host the webapp in a remote server and the you are accessing this website from a different client machine, there would be no choice and will be entirely controlled by the browser which you use
|
|
|
|
|
I have a DataGrid on my form that users type in numbers. The problem them I am having is that if they do not hit enter after they type in the number, that value is never set. How can I change this so its value is set without the user having to push enter?
Is it the way I am pulling the data or something else?
TixTypeQuanity = dataGridTicketTypes.Rows[dataGridTicketTypes.Rows[dgvr.Index].Index].Cells[4].Value.ToString();
|
|
|
|
|
you can set the AUTOPOST property in asp.
|
|
|
|
|
I was able to fix this as I had the datagrid set as
this.dataGridTicketTypes.CausesValidation = false;
changing this to true fix the issue
|
|
|
|
|
Text box lost focus simple solution
|
|
|
|