Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

goodpilot

@goodpilot
About
Posts
14
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Very Slow Startup Time
    G goodpilot

    It happens every time I load the application. I have 4 different apps that I load on that machine and they all take a very long time to load compared to my development box. The server is a 2.4 GHz dual xeon processor machine running Windows Server 2003, which comes with .NET preinstalled. My dev box is a 2.4 GHz single processor laptop. I thought perhaps it was because I did not change tempuri.org in the XML file that the app has to load, because the server does not have access to the internet. However, if I delete the tempuri.ord entry I the app still loads slow. Robert

    C# csharp visual-studio design xml question

  • Very Slow Startup Time
    G goodpilot

    When I run my C# application on the same machine on which Visual Studio is installed it starts up very very quickly. However, when I start it on a machine that does not have Visual Studio installed it takes what seems like minutes before the UI appears. The app is using an XML file for reading in it's parameters and that file is loaded in the Form_Load event. Is it the XML file that is causing the slow startup on machines that do not have Visual Studio? What can I do to make it start just as quickly as it does on my dev box. Robert

    C# csharp visual-studio design xml question

  • Multicast Programming
    G goodpilot

    As usual you are a big help. I will looking thread pooling as a solution. Thanks, Robert

    C# help c++ csharp dotnet sysadmin

  • Multicast Programming
    G goodpilot

    I am writing an app that needs to receive multicast data. However, the amount of data being sent on a single multicast group is enormous and I do not have any control over the publishing side of the data. So what I'd like to do is to run multiple instances of the same app on a single, high power machine and assign each instance of the app a manageable segment of the total multicast feed to process. So for example run 4 apps and let each of them process only 1/4 of the total amount of data each. But here is the problem, which I hope one of you will be able to help me solve. If I run multiple instances that all try to join the same multicast group on the same machine I get the following error: System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted This happens when the UdpClient object is being instantiated as follows: udpClient = new UdpClient(portNumber); The interesting thing is that I do not have this problem when I run an app that was built using Visual C++ and WinSock. It only happens with the .NET framework. Does anyone have an answer to this other than "use 4 separate machines"? Thanks Robert

    C# help c++ csharp dotnet sysadmin

  • How Can I Unload an Assembly?
    G goodpilot

    Well I did try following that example and it worked up to a point. I get Serialization exceptions because .NET is trying to serialize System.Threading.Thread and other System classes. I can only modify my own classes to meed serialization requirements. What do I do about the System classes I need objects of sever System types in the assembly that I am trying to load into a separate AppDomain. For more than 2 years I did not have any such issue because I was loading assemblies into the default AppDomain. But I now have a need to dynamically load and unload them. Do you know of a solutions that will not try to serialize System classes. I can only modify my classes with MarshalByRefObject or [Serializable]. Thanks Robert

    C# question tutorial

  • How Can I Unload an Assembly?
    G goodpilot

    I can successfully load an assembly dynamically at runtime. But what if I want to unload it and load another one without having to shutdown my application. Does anyone know how to do that? I use Activator.CreateInstance to load assemblies. But I have not found anything that I can use to unload one.

    C# question tutorial

  • C# time to C++ time_t
    G goodpilot

    Two lines of code! Thank you much.

    C# csharp c++ question

  • C# time to C++ time_t
    G goodpilot

    I am sending binary data between C# and C++ successfully. However, I would like to convert the C++ time_t, which is a 32 bit long in C++ to a C# DateTime. Does anyone have a solution off hand for converting time_t to a C# DateTime value and from a C# DateTime to a C++ time_t?

    C# csharp c++ question

  • Socket Programming - How Do I Send and Receive a Class or Structure
    G goodpilot

    I was able to get it working with your help sir. Thank you very much.

    C# question sysadmin help csharp c++

  • Socket Programming - How Do I Send and Receive a Class or Structure
    G goodpilot

    I have tried this successfully. But only with a class and struct that does not contain a string or byte array field. For example: [StructLayout(LayoutKind.Sequential, Pack=1)] public struct MyPacket { public MyPacket(DateTime dateTime, int line, int msgLen) { dt = DateTime.Now; iLine = 0; iMsgLen = 0; msg = new byte[80]; } public DateTime dt; public int iLine; public int iMsgLen; public byte[] msg; } Marshal.Sizeof(MyPacket) returns 20. So when it is sent over the network I the contents of msg is lost. Obviously because byte[] is a reference to an array. So, now the question is how can I pass classes or structures as binary data if they contain arrays, for example a message that contains a stock quote needs to include a symbol name (i.e. "MSFT"). Can you help me out with this as well? I have not been able to find any examples or documentation that shows StructLayout being used with structures or classes that contain strings or arrays. By the way, what does Microsoft MVP mean? Are you a Most Valuable Player at Microsoft? Thanks for the assistance, Robert G. Ellis

    C# question sysadmin help csharp c++

  • Socket Programming - How Do I Send and Receive a Class or Structure
    G goodpilot

    I have tried this successfully. But only with a class and struct that does not contain a string or byte array field. For example: [StructLayout(LayoutKind.Sequential, Pack=1)] public struct MyPacket { public MyPacket(DateTime dateTime, int line, int msgLen) { dt = DateTime.Now; iLine = 0; iMsgLen = 0; msg = new byte[80]; } public DateTime dt; public int iLine; public int iMsgLen; public byte[] msg; } Marshal.Sizeof(MyPacket) returns 20. So when it is sent over the network I the contents of msg is lost. Obviously because byte[] is a reference to an array. So, now the question is how can I pass classes or structures as binary data if they contain arrays, for example a message that contains a stock quote needs to include a symbol name (i.e. "MSFT"). Can you help me out with this as well? I have not been able to find any examples or documentation that shows StructLayout being used with structures or classes that contain strings or arrays.

    C# question sysadmin help csharp c++

  • Socket Programming - How Do I Send and Receive a Class or Structure
    G goodpilot

    Thank you very much. That was very helpful.

    C# question sysadmin help csharp c++

  • Socket Programming - How Do I Send and Receive a Class or Structure
    G goodpilot

    Thanks for the advise folks. I am aware of the type differences between C++ and C#. So that would not be a problem for me. However, what about structure packing (i.e. #pragma pack(1))? Does StructLayoutAttribute ensure that the resulting structure in C# would be packed on the same boundaries as the C++ equivalent? How about passing classes between a C# client and a C# server, is Remoting the best choice or should I use the same technique as passing structures between C# and C++ clients and servers? I am most concerned about performance more than anything else because I am working on a stock trading application that needs to process huge amounts of streaming market data in real time.

    C# question sysadmin help csharp c++

  • Socket Programming - How Do I Send and Receive a Class or Structure
    G goodpilot

    In C++ you can do something like this: MyClass * myClass = new MyClass(a, b, c); ... ... mySocket->Send(myClass, sizeof(MyClass)); when receiving: BYTE buf[MAX_SIZE]; mySocket->Receive(&buf, sizeof(MyClass)); myClass = (MyClass *) &buf; In other words, given an instance of a class or structure you can send/receive it over tcp/ip as a binary object without having to do any special coding or serialization. How do I achieve the same thing in C#? I have a C++ based server that I want to communicate with using a C# front-end. The C++ server sends and receives structures. How can I convert a C# class or structure into raw bytes and send it over the network. The networking examples that I’ve been able to find all use strings, which are simple to convert to a series of bytes. I have not been able to find a single C# networking example that sends objects or structures over the network. Any help from someone who has solved this issue (without serialization) would be greatly appreciated. Thanks Robert

    C# question sysadmin help csharp c++
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups