|
When I program in Java I have a steam option available called ObjectStream which allows me to read/write objects to (in particular) a network stream (or what is better known as a Socket). This allows me to send open a socket and send several objects down to the other end and then close the socket.
Is there something similar in DotNet? I knwo that Remoting is available but this is not exactly what I am after?
Many thanks in advance.
Bara
|
|
|
|
|
PhantomLix wrote: Is there something similar in DotNet? I knwo that Remoting is available but this is not exactly what I am after?
Well that's what remoting does, sort of ++. There is also Serialization where the serialized data can certainly be written/read to/from a stream.
led mike
|
|
|
|
|
Yes. You need to open a socket (probably using the System.Net.Sockets.TcpClient class), get the stream for that connection (probably a System.Net.Sockets.NetworkStream), and serialize your object over the stream (probably using the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter class). Then the other side can deserialize the object and reconstruct the original. Your objects must be serializable, either by default (all state information must be exposed by properties with serializable types), or by you implementing the ISerializable or IXmlSerializable interfaces. Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
I'll state first off I'm not entirely certain if this, or the COM board is the most appropriate venue because it overlaps several issues. I'm trying here first since it has the largest audience.
I'm developing a managed COM wrapper for some existing C# components for use in a VBA (excel) application. One of them is a static class around a configuration file. Its constructor uses System.Windows.Forms.Application.StartupPath + "\relativePath\filename.ini" to construct the path to the data file.
In my VBA application StartupPath returns the path to Excel.exe, not the .XLS file with the VBA code or the COM DLL. Nor can I find a way to get the path to either of those files (both of which could be used to construct the path) programmatically. Because the constructor is static, I can't pass the path in as a parameter.
Without changing the behavior of the ini reader to move initialization outside of the constructor, is there any way around this problem?
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop.
-- Matthew Faithfull
|
|
|
|
|
string callingCodeLocation = Path.GetFullPath(Assembly.GetCallingAssembly().CodeBase); Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
actually:
Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location)
.CodeBase returns a URI that path chokes on.
Skippums wrote: Sounds like somebody's got a case of the Mondays
More like I've recovered from a bad case of the Fridays enough to find the energy to do "Help" posts.
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop.
-- Matthew Faithfull
|
|
|
|
|
|
|
Please use assert when testing so the compiler can remove them.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Member 4621752 wrote: dddddd
|
|
|
|
|
eeeeee
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
|
|
|
|
|
I've got a puzzling problem.
I've got a child window inside of a parent window (An MDI application) and I want to Hide the parent whilst keeping the child window open.
Is there any way to do this?
|
|
|
|
|
Not with an MDI application.
|
|
|
|
|
Well is there any way to grab all of the entities in the child window and copy and paste them into a new window?
That's another way to get around it.
|
|
|
|
|
Yea you should be able to do that, just send the instance of the child window to the new parents constructor.
Mark.
|
|
|
|
|
I have a variable I need to add to an output string for generating some C# code.
The intent is the line should be
ConfigurationManager.ConnectionString["Talker"].ToString();
and the code to generate that line is as such:
StringBuilder conName = new StringBuilder();
conName.Append("\t\t\t\t\t\t");
conName.Append("ConfigurationManager.ConnectionStrings[\"");
conName.Append(parameters.UseConnectionStringName);
conName.Append("\"].ToString();");
swBaseClass.WriteLine( conName.ToString() );
When I look at conName it is formatted correctly.
ConfigurationManager.ConnectionString["Talker"].ToString();
When I view the resulting code the line reads
ConfigurationManager.ConnectionString[""].ToString();
Any suggestions on why my variable name is not being written out???
|
|
|
|
|
Dunno... do you need to add .Value to parameters.UseConnectionStringName or something?
|
|
|
|
|
Please read the entire post. The text existed as a string correctly.
If you do not know, then why post a reply?
|
|
|
|
|
I did, and saw nothing wrong, and now I've read it again and still don't.
Are you saying that when you inspect the StringBuilder in debug you see the whole value, but when you write it out you don't? What are you using to vew the resultant file?
|
|
|
|
|
was using new code that used the wrong field.....DOH
|
|
|
|
|
If you don't need the StringBuilder for anything else, why not eliminate it?
swBaseClass.WriteLine
(
"\t\t\t\t\t\tConfigurationManager.ConnectionStrings[\"{0}\"].ToString();"
,
parameters.UseConnectionStringName
) ;
|
|
|
|
|
Hi all,
i m creating some appointments in outlook.
To find those appointments i added a userproperty to it :
oAppointment.UserProperties.Add(nr, Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText, true, System.Reflection.Missing.Value);
nr is a string from user's input.
Now how can i find and update/delete those appointments?
|
|
|
|
|
I'm trying to smoothly fade an image onto the screen, but I can't seem to get smooth performance out of GDI+. Can anyone recommend an alternative?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
WPF works nicely for this sort of thing.
Or if .NET 3 isn't an option, how about XNA[^]?
That said, I think you should be able to get good perf out of GDI+ if you do things right. Have you run a perf profiler (such as ANTS[^]) on your code to see if anything seems out of the ordinary?
|
|
|
|
|
Get a direct draw handle for your Control. There is an article somewhere. GDI+ is very slow.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|