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
J

James Smith

@James Smith
About
Posts
7
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Socket Receive Problems
    J James Smith

    Interestingly enough, your post got me thinking, and I added the bold code below.

    while (bIncoming[0] != (byte)MessageWrapper.SOM)
    {
    // Loop Waiting for and Start Of Message Character
    tryRead = 1;
    read = connectionSocket.Receive(bIncoming, 0, tryRead, SocketFlags.None);
    Byte[] b = new byte[1];
    b[0] = 0x30;
    connectionSocket.Send(b, 1, SocketFlags.None);

    }

    Now, I get an exception that the host has aborted the transaction on the second time through the loop! The first receive appears to be successful, the send is successful, then the subsequent receive fails. Any idea how to create/catch the exception without the need of a Send? The send will mess up the server when the server does decide to respond properly. Thanks for your help. James

    .NET (Core and Framework) csharp sysadmin help question

  • Socket Receive Problems
    J James Smith

    I just tried setting "KeepAlive" socket option to true but it didn't have any affect. The bizzare part here is that the lower level (seen through the network trace) shows that the connections is being shutdown by the server. The network layer of the client responds with an acknowledgement, but the Framework doesn't seem to detect it. It is very possible, (and probable) that i am doing something wrong in my code. I have found in the past that it is difficult to detect that a remote host has disconnected when sending data... Send always seems to succeed unless the TCP buffer is full at the network layer. The "detection" usually comes when the application tries the next receive... but alas.. not in this case...

    .NET (Core and Framework) csharp sysadmin help question

  • Socket Receive Problems
    J James Smith

    Hi Mike, Thanks for the reply. I open the socket connection to the client as follows:

    connectionSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

    if (traceFlag)
    {
    LogMessage(Severity.ER_SEVERITY_INFO_RETURN, myFilename,
    "Socket.Open(): Attempting connection to {0}:{1}", hostName, port);
    }

    /*======================================================================*/
    /* Connect our socket to the other end */
    /*======================================================================*/
    try
    {
    // .NET Framework 1.1 format commented out, use new 2.0 connect
    // EndPoint ep = new IPEndPoint(IPAddress.Parse(hostName), (int)port);
    connectionSocket.Connect(hostName, port);
    }
    catch (Exception ex)
    {
    Close();
    throw ex;
    }

    The portion of the receive that isn't behaving is as follows:

    while (bIncoming[0] != (byte)MessageWrapper.SOM)
    {
    // Loop Waiting for and Start Of Message Character
    tryRead = 1;
    read = connectionSocket.Receive(bIncoming, 0, tryRead, SocketFlags.None);
    }

    The above receive loops forever, with zero bytes received. When I debug the properties of "connectionSocket" I see Connected = true and Available is 0. I would imagine this is because the server has initiated a shutdown, however, it appears the framework is not detecting it. Hopefully the code snippet helps. Let me know if you need more info. Thanks for your help. Kind Regards, James

    .NET (Core and Framework) csharp sysadmin help question

  • Socket Receive Problems
    J James Smith

    Hi All, I am having some problems with .NET Socket Receive Method. I have a client application which I am sending data to a server app. The send works properly, the server receives it. I am expecting a response back from the server, but due to unforseen problems the server doesn't respond. My client application does not block at the Socket.Receive() and loops indefinately waiting for data. I would expect it to block (or wait a specified timeout) until either an exception is thrown (timeout, or closed socket), or data is received. Debugging the connection socket properties on the client reveals that the application thinks the socket is still Connected, and there is no data available. I loaded up WireShark, and traced the connection. It appears that the server is initiating a shutdown, by sending a FIN packet. I see a lower level FIN ACK being sent back to the server from the client, however the application code doesn't seem to detect this. Could this be why the socket doesn't block at the Receive? Is there a way to detect that the server wishes to close the connection? FYI, the client application is currently written in C# using .NET 3.5 framework. Any suggestions would be greatly appreciated. Thanks for your help in advance. Kind Regards, James

    .NET (Core and Framework) csharp sysadmin help question

  • Writing DNS Records
    J James Smith

    Hi All, I would like to write a small application to read and write DNS records to my Windows 2003 DNS Server through an ASP.NET webpage. Does anyone have any resources on the DNS API, or how I can accomplish this? Can someone point me in the right direction to get started? Any help would be greatly appreciated. Thanks in Advance, James

    ASP.NET csharp asp-net sysadmin json help

  • COM Wrapper for C++ DLL
    J James Smith

    Hi all, I have a C++ DLL that I "think" I need to make COM aware to make it work on both 32 and 64 bit windows processors. According to Microsoft site: "On 64-bit Windows, a 64-bit process cannot load a 32-bit dynamic-link library (DLL). Additionally, a 32-bit process cannot load a 64-bit DLL. However, 64-bit Windows supports remote procedure calls (RPC) between 64-bit and 32-bit processes (both on the same computer and across computers). On 64-bit Windows, an out-of-process 32-bit COM server can communicate with a 64-bit client, and an out-of-process 64-bit COM server can communicate with a 32-bit client. Therefore, if you have a 32-bit DLL that is not COM-aware, you can wrap it in an out-of-process COM server and use COM to marshal calls to and from a 64-bit process." (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win64/win64/process\_interoperability.asp)" Unfortunately, I don't have a whole lot of COM experience. Can anyone point me at some resource to help me out with this project? Anyone with good/bad experience doing this type of wrapper? Any suggestion, or help would be greatly appreciated. Thank you in advance, James

    COM c++ com sysadmin help question

  • Using an unmanaged C++ DLL in ASP.NET
    J James Smith

    Hi all... I have a DLL which was created in C++ that I am trying to use in an ASP.NET(VB) web application. In my DLL, I have exported my functions as follows: extern "C" __declspec(dllexport) int Init(char *szString1, char *szString2) In the .NET application, I have imported the library using: Public Declare Function Init Lib "MyLib.dll" (ByVal Hostname As String, ByVal Port As String) As Int32 I copied the library into the bin directory of the .NET application. This seems to run properly on my local machine, but once I moved it to a production webserver, I get an error "Unable to load MyLib.dll" Does anyone have an idea how to solve this problem? Any suggestions would be greatly appreciated. Thanks in advance, James

    ASP.NET help csharp c++ asp-net tutorial
  • Login

  • Don't have an account? Register

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