|
Hi all
how can i change the color of the titlebar without affecting windows settings and add only the minimize button to it
thx
|
|
|
|
|
|
I am using C#.NET Framework 1.1 and i made a windows service which is running in background. This service opened a socket (Listener) on a specified port at startup. Client connected to this port and send a message to listener and close the socket again client connect after some time maybe after 5 minutes or above and send another message to listener and close the socket. (Socket is Accpeted, Send & Receive data Asynchronously)
This service work fine for a period of time. But after that
Question: Socket does not accept new connection while socket is in listening state.
Whenever i want to connect to this socket (either by Telnet or by my client on lan or wan or even by local-loop) the exception is occured.
Error Code: WSAECONNREFUSED 10061
Description: No connection could be made because the target computer actively refused it.
After restart the service, socket works fine again for some period of time.
Is there any solution.
Thanks in advance
Zeeshan
|
|
|
|
|
I think you misuse the socket. Do you have sample code?
Basically, the Socket.Accept() method returns a new Socket object. You must use this object to talk to the client, usually on another thread, so the server socket can return into accepting a new client request.
Also, when programming with sockets, you must be careful that the Socket returned by Accept is disposed of [Socke.Disconnect()]. That is probably where your problem is: you ignore the returned socket and use the server one to talk to the client, hence not disposing of the returned socket, which makes your server run out of connections.
Post the code, and I will probably be able to help you out.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
-- modified at 9:57 Tuesday 24th January, 2006
|
|
|
|
|
When I use the following code with the EnableSsl line commented out, all is well. Otherwise I get this error: The message or signature supplied for verification has been altered.
FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(myUrl);
ftpRequest.Credentials = myCredentials;
ftpRequest.EnableSsl = true;
ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
using (FtpWebResponse ftpResponse = (FtpWebResponse)ftpRequest.GetResponse())
Does anyone have any experience using the FTP objects with SSL?
Thanks!
|
|
|
|
|
Is it possible to use the configurationManager is a windows form in .net 2.0 or is it just for ASP.NET 2.0 ?
Thanks
|
|
|
|
|
fmardani wrote: Is it possible to use the configurationManager is a windows form in .net 2.0
Yes.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Dear all,
I am using C# to alter a DBF file , Foxpro driver downloaded ,Everything working fine but after running alter query whole DBF format gets corrupted. And I am not able to open it again.
I am adding the code snippet below.Do help me in this regard
public void Alter_table()
{
try
{
string strConnect;
strConnect="User ID=;DSN=;Collating Sequence=MACHINE;Data Source='d:\\22.dbf';Provider=VFPOLEDB.1;Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Exclusive;Extended Properties=;Encrypt Password=False";
OleDbConnection dconn=new OleDbConnection();
dconn.ConnectionString = strConnect;
dconn.Open();
OleDbCommand mycmd=new OleDbCommand();
OleDbCommand myCmd = new OleDbCommand("ALTER TABLE 22.dbf ADD COLUMN TEST1 c(10) NULL", dconn);
myCmd.ExecuteNonQuery();
}
catch(OleDbException ex)
{
MessageBox.Show(ex.Message);
}
}
Thanks for any kind of help
hi it is rudara
|
|
|
|
|
I've never worked with FoxPro, but to me it seems odd to specify the name of the database file (22.dbf) in an alter table statement. Shouldn't it be the name of the table you want to modify, like:
ALTER TABLE TEST ADD COLUMN TEST1 c(10) NULL
|
|
|
|
|
I know this one is going to be a hard one. I need to populate a treeview with an XML file. I also need to save the contents of that same treeview to an XML file. The contents inside of the treeview will be user driven. Therefore, the number of entries within the XML file will never be absolute. I need some kinda of dynamic loader and exporter. Any ideas? I have searched all over the web, but I have yet to find what I am looking for. Thanks in advance.
P
|
|
|
|
|
It is unclear if you are talking about a specific XML format, or XML files in general.
Anyway, this should work: Load the XML file into an XmlDocument and walk though it adding tree nodes as you encounter elements. You can also use an XML loader, which might be better for large files.
Is it a specific XML format you might be better of with a data mapper able to serialize and deserialize the XML into an object model.
Be careful when populating a tree with many nodes - it can be a performance problem - it might be better to add the child nodes "on demand" as the tree is expanded.
For writing, walk though your tree and write to an XML Writer (or build a new XmlDocument, then save that)
|
|
|
|
|
|
I am using:
using System.Configuration;
and would like to refer to the appsettings in the app.config
How can I do this in .net 2.0
The intellisense does not show ConfigurationManager
Thanks
|
|
|
|
|
This is because you did not reference the system.configuration.dll assembly. In .NET 2.0, the System.Configuration namespace is spread across System.dll and System.Configuration.dll
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
hey howzit,
i have an .EMF image (its just text) sitting in a picturebox. its about a4 in size (so when in runtime mode it covers half the width and more than the height of the screen).
problem is i can't see the text, so i need to beable to enlarge the image to fit the full width of the screen WITHOUT LOOSING quality or resolution i.e. i wanna have the same zoom in/zoom out functionality that Windows Picture & Fax viewer has.
can you help?
|
|
|
|
|
Hello, there. I'm looking for a way to remove the last tag in an XML file in a fairly quick manner. Here's the scenario. I have an XML file used as a session log of an application. You can include one or more session logs in the same file, so I have the following format for the XML:
<SessionLogs>
<SessionLog date="01/24/2006" time="6:45:31 AM">
<SessionEntry>
<Data> ... </Data>
</SessionEntry>
</SessionLog>
</SessionLogs>
The session log file can be quite large so I don't want to read it into an XMLDocument object, chop the last tag, and write the file back out just to remove one line from the file. Also, since the file can be large, I was hoping that I wouldn't have to parse through the whole thing to get to the end for one line. Does anyone know how this could be best accomplished? Is there a way to seek backwards through a file stream (i.e. after the file has been opened in Append mode) by one line and remove the line? Any suggestions would be greatly appreciated. Thanks.
Rick
-- modified at 7:53 Tuesday 24th January, 2006
|
|
|
|
|
Use the XmlTextReader class. When you are positioned to the SessionLog node, call the XmlTextReader.ReadOuterXml, which will return a string representing the XML of the current node.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Hi, Michel. Thanks for the suggestion. Would this in essence place the whole XML document in memory in one string or am I misunderstanding how XmlTextReader would work? I was trying to avoid placing the whole document in memory if possible because of the size of the XML file. Perhaps I'm misunderstanding how this really works. Thanks.
|
|
|
|
|
I don't know the exact inner workings of XmlTextReader, but I can tell you it does not read the entire XML. XmlTextReader.Read() allows you to move to the next node (look at XmlNodeType enumeration to see all the node types).
I am sure that this is far more efficient than XmlDocument.
You could make an experiment: try both methods with a very large document and see which is faster. Try with both experiment with the same file at the same location on disk.
I could bet 20$ that XmlTextReader will win the race.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I agree with the performance entirely. One other thought. XmlTextReader gets me to the position in the file, but then what do I do with it? XmlTextReader provides read only access to the file. How do I end up stripping the last tag from the file if XmlTextReader doesn't read the whole XML document into memory for me to write back out (minus the ending tag, of course)? Perhaps I'm still missing something obvious.
-- modified at 15:37 Tuesday 24th January, 2006
|
|
|
|
|
When you are positioned in the correct node, after a number of calls to XmlTextReader.Read() and XmlTextReader.Name, when you realize you are on the node you want, make a call to XmlTextReader.OuterXml() to get a System.String object containing the XML within the <SessionLog> node only.
Look at the XmlTextReader documentation, you find it is very easy. For instance.
while (myReader.Read())
{
if ((myReader.NodeType == XmlNodeType.Element) && (myReader.Name == "SessionLog"))
{
return myReader.OuterXml();
}
}
This is not the most elegant code, but it is to illustrate the use of the XmlTextReader for your needs.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Can you see how I can get this code to compile please?
public string SmtpServer
{
set
{
System.Web.Mail.SmtpMail.SmtpServer = value;
}
}
may be I should use something like:
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(value);
if so then how do I set SmtpServer?
Thanks
|
|
|
|
|
Hi,
I am converting a 1.1 code to 2.0
The line that I would like to convert is
System.Web.Mail.SmtpMail.SmtpServer = SMTPserverName;
P.S. using outlook
do you know what should this line be in 2.0 ?
Thanks
|
|
|
|
|
If you're using the System.Web.Mail classes, you're not using Outlook. You're using the CDOSYS library, or CDONT on NT 4.0.
In .NET 2.0, you can continue using System.Web.Mail which will continue to use CDOSYS/CDONT. The new version of the framework adds a new namespace, System.Net.Mail, which implements the SMTP protocol directly in managed code. To send mail, you need to create an instance of the SmtpClient class. You can pass the SMTP server name to the constructor.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I can not get this to work
public new void To(string email)
{
base.To = email;
}
the error is:
can not implicitly convert type string to system.net.mail.mailaddresscollection
Thanks
|
|
|
|