|
Sure. But really you probably don't want to use sockets directly as that's fairly low level. You might want to use System.Runtime.Remoting to pass objects (presumably containing XML data) across to another machine. FYI, if you use remoting over HTTP, all data packets are sent in a stream of XML anyway. The other option is using remoting over the TCP channel, in which data gets sent as a stream of binary formatted data.
If you're looking for more info on remoting, MSDN has some good examples, and you might also want to check out Ingo Rammer's remoting site[^].
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
The transport channel (HTTP or TCP) has nothing to do with the format of the data. This depends on what formatter you specify in your remoting configuration. Both a SoapFormatter and BinaryFormatter are provided in the FCL and can be used for any transport channel (unless some third-party transport channel is anal about that or something).
The transport channels may default to a specific formatter, but it can be changed.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Right you are, I stand corrected. Typically, one would use a binary formatter for use over a TCP channel, and a SOAP formatter for use over an HTTP channel, but yeah you're right it doesn't have to be that way.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
Heath,
I think in addition, Formatter sink are used to serialize IMessage, have nothing to do with the XML in IMessage. ie. You can even transmmit XML using BinaryFormatter. Transmitt XML using Socket is realistic since mobile device may not support remoting.
Correct me if I am making mistakes
Thanks
James
|
|
|
|
|
No, you're not wrong, but I fail to see what you're getting at. The DataSet , for example, still serializes as XML even using the BinaryFormatter , but the only point I was making was that no specific formatter must be used with any specific transport channel.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I used to convert a double like so:
double l_dTmp = 0.0;
string l_szTmp = l_dTmp.ToString("e3");
The output was:
0.000e+000
On my new computer (Windows2000, SP4) I do the same but the output is:
0.000e,000
The '-' sign is formatted fine.
Can anyone help?
Thanks
|
|
|
|
|
This is going to sound really weird...
I think your Regional and Language Settings have got screwed up. In the registry, go to HKEY_CURRENT_USER\Control Panel\International and set the sPositiveSign value to an empty string.
I just set mine to ',' and reproduced your problem.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Actually, it's recommended you use the "Regional and Language Options" control panel applet. Either way should work, though. Hacking the registry can be dangerous if you screw up.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I checked the registry and the entry for sPositiveSign is blank. I added the + sign and it converts the double values fine. However, my older computer has also a blank entry but it ads the '+' sign.
When I use ToString("e3", new CultureInfo("")) it also works fine but I get ',' instead of '+' with "en-US" culture.
Thanks for your help
|
|
|
|
|
I have an application that runs on our server that I can no longer get support for.
The application runs great for days at a time and then it crashes.
I would like to write a task manager type utility that would automatically cancel the application.
Can you point me in the right direction? C++ or C# code highly desired.
thanks
|
|
|
|
|
I'm not sure I fully understand you. Do you want to monitor when the program has crashed? If so, you can do this quite easily in any .NET language using System.Diagnostics.Process.GetProcessesByName (or one of the other static methods of the Process class) to determine whether the process is still running.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
thank you - that was helpful
|
|
|
|
|
How can I detect in a ListView control (Details View) if the user selects a new row by using the keyboard (up or down arrow)?
|
|
|
|
|
You can use ListView.SelectedIndexChanged event to determine when a new item has been selected. You can probably override the ProcessCmdKey of your form to know when a key's been pressed.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
ListView.SelectedIndexChanged event does not get triggered if I hit the arrow down key...
|
|
|
|
|
|
We want to retrieve data from a Navision 3.70 C/Side database using .NET. We managed to create a DSN and retrieve data from the Navision database by using Excel or MSQuery.
When i try to read data from my .NET application using the same DSN i get an error:
ERROR[IM001][Microsoft][ODBC Driver Manager]Driver does not support this function
.NET code (C#)
=============
OdbcConnection conODBC = new OdbcConnection(“DSN=Sample C/ODBC 32 bit”);
conODBC.Open();
DataTable dt=new DataTable();
OdbcDataAdapter da = new OdbcDataAdapter("SELECT * FROM Klant", conODBC);
da.Fill(dt);
============================================================================
The first two lines successfully connect to the Navision database (which is specified in the DSN).
The last two lines should retrieve data from the database but instead they give the error.
Can anyone help?
|
|
|
|
|
Maybe the ODBC driver does not support ado.net provider.
Try the higher version of ODBC driver.
best regards
Samuel
|
|
|
|
|
From my C# client,I try to plug in a custom provider,through a configuration file
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="http">
<clientProviders>
<formatter ref="soap" />
<provider type="CustSinkProviderLib.CustSinkProvider, CustSinkProviderLib"
customSinkType="CustProviderLib.CustomSink, CustProviderLib" />
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
However I get a remoting error with the following stack
Additional information: Remoting configuration failed with the exception System.Runtime.Remoting.RemotingException: Cannot load type CustSinkProviderLib.CustSinkProvider, CustSinkProviderLib.
at System.Runtime.Remoting.RemotingConfigInfo.LoadType(String typeName, String assemblyName)
at System.Runtime.Remoting.RemotingConfigHandler.CreateChannelSinkProvider(SinkProviderEntry entry, Boolean bServer)
at System.Runtime.Remoting.RemotingConfigHandler.CreateClientChannelSinkProviderChain(ArrayList entries)
at System.Runtime.Remoting.RemotingConfigHandler.CreateChannelFromConfigEntry(ChannelEntry entry)
at System.Runtime.Remoting.RemotingConfigHandler.ConfigureChannels(RemotingXmlConfigFileData configData)
at System.Runtime.Remoting.RemotingConfigHandler.ConfigureRemoting(RemotingXmlConfigFileData configData).
Since it is difficult to find out the cause,I wish to do the same through code.
Can someone provide a sample code of how to invoke the provider and custom sink through code,rather than config file?
|
|
|
|
|
The cause should actually be pretty obvious: the type cannot be loaded. Either the assembly containing it (CustSinkProviderLib) cannot be found or the Type in that assembly doesn't exist (perhaps an older assembly is being used, for example).
The assemblies must be resolvable. See How the Runtime Locates Assemblies[^] in the .NET Framework SDK for more information.
Also, this assembly would need to be resolvable on both the client and server.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi, I would like to know if String Class provides a method to print hex value on a MessageBox... I would like to print CRC file, saved in a ulong variable in my old C written code... using String.ToString prints decimal value..... any way to change it?? thanks
Paolo
|
|
|
|
|
Yeah, change the method call in .ToString() to .ToString("X"). This will format the output as Hex. This will only work if your converting a numeric value to a string. If your try this on a String object, it won't work. You have to convert the string value back to a number, then use the format "X" in the .ToString method.
RageInTheMachine9532
|
|
|
|
|
Actually, you should use Byte.ToString("x2") , or use String.Format("{0:x2}", someByte) or something like that. Without the "2", you'd get an invalid representation of bytes with values less than 127.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Just open browseui.dll from %WINDIR%\System32 in Visual Studio .NET. Expand the Bitmap resource section and find the image strip you want. You can export that and then load it using ImageList.Images.AddStrip , or break-up the images into squares and add them individually.
Legally, you're not supposed to do this and just use the older images in the Common7\Graphics directory of your Visual Studio .NET installation, but only commercial products would probably suffer any consequences. I have been talking to Microsoft about updating those images since they're grossly out-dated.
Microsoft MVP, Visual C#
My Articles
|
|
|
|