473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Passing win32 socket handle to .net application possible?

mlc

I have a server (in win32 C++, TCP) that listens and accepts socket calls,
then via CreateProcess and handle inheritence over the command line starts
up a process to handle the client request. Is there any way I can write a C#
application that can also handle the client request from a open handle from
a win32 process in a like manner? (No, I can't rewrite the server in C#, or
change it in any fundmental way, I can however replace the request handling
program and a small amount of the server code)

Is this possible and how to do it?

Thanks,

Mark
Nov 15 '05 #1
2 2936
"mlc" <ma****@earthlink.net> wrote in
news:Mt*******************@newsread1.news.pas.eart hlink.net:
I have a server (in win32 C++, TCP) that listens and accepts socket
calls, then via CreateProcess and handle inheritence over the command
line starts up a process to handle the client request. Is there any way
I can write a C# application that can also handle the client request
from a open handle from a win32 process in a like manner? (No, I can't
rewrite the server in C#, or change it in any fundmental way, I can
however replace the request handling program and a small amount of the
server code)


You can make the calls directly to Winsock yourself. While you dont state it
the inherited handle is a socket handle I assume?

Or are you wanting to somehow pass that handle to the System.Net.Classes?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 15 '05 #2
mlc
It is a socket handle. I would idealy like to goto to System.Net rather than
make unmanged code calls. However the passing part is what has stopped me.

"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message
news:Xn******************@127.0.0.1...
"mlc" <ma****@earthlink.net> wrote in
news:Mt*******************@newsread1.news.pas.eart hlink.net:
I have a server (in win32 C++, TCP) that listens and accepts socket
calls, then via CreateProcess and handle inheritence over the command
line starts up a process to handle the client request. Is there any way
I can write a C# application that can also handle the client request
from a open handle from a win32 process in a like manner? (No, I can't
rewrite the server in C#, or change it in any fundmental way, I can
however replace the request handling program and a small amount of the
server code)
You can make the calls directly to Winsock yourself. While you dont state

it the inherited handle is a socket handle I assume?

Or are you wanting to somehow pass that handle to the System.Net.Classes?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Mike M | last post by:
Is it possible? In the parent process, I have a socket that binds, listens and then accepts new connections (which creates new sockets in the process). I want to be able to pass some of these new...
3
by: David Douard | last post by:
Hi everybody, let me explain by problem: I am working on an application which consists in a C++ dll (numeric computations) and a Python IHM (Python/Tk), which must run under Linux and win32. My...
2
by: Shawn Anderson | last post by:
Anyone know how I can get a Win32 HANDLE from a StreamReader or StreamWriter? I want to work with some I/O using Win32 APIs, but I would like to attach the I/O to a .NET Stream class. Any...
6
by: Can Balioglu | last post by:
Hi everyone, My question is not a technical one. I'm just curious about the future of Win32 (and Win64) programming. Most of the books about Win32 from MS Press (like Programming Windows,...
5
by: Arno | last post by:
reposted with the right microsoft managed newsgroup ID: Sorry for the inconvinience Hi, I've written a class for client-socket connection, but I get a lot of times the error message "Unable...
0
by: dan.jakubiec | last post by:
I'm trying to write a Python app which accepts a socket connection and then spawns another Python process to handle it. I need it to run under both Linux and Windows. I have it working under...
2
by: kurt.kurtsmith | last post by:
I have a COM object which returns the socket handle it is currently connected to as a 32 bit WIN32 handle. I want to send data to this already connected socket connection but can't seem to figure...
4
by: Adam Clauss | last post by:
A while back I posted regarding a problem we were having with one of our applications which was randomly crashing. Monitoring memory usage revealed a spike in nonpaged pool memory just prior to...
1
by: kash123 | last post by:
Hi All, I have written an application, a part of which, in the application, is a socket server programe accepting connection requests from socket clients. My server code typically contains, ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.