C# windows (WinForms) child application locks sockets -


i have 2 windows c# winforms applications behave same way related issue. behavior exhibits if applications ran in order: main application starts , part of normal working process opens sockets; mixture of tcp udp , multicast. @ time pressing button starts application using c# process related libraries. second app starts ok , ok.

it known , acceptable if start second instance of main app second instance won't able use sockets first 1 owns. issue have if shutdown first app , restart, won't able acquire sockets anymore... until child app shutdown. note second app doesn't use sockets whatsoever, somehow windows keeps sockets locked until second app shuts down.

i have question related programming in c# win forms on topic capital letters people can not distinguish on/off topic:

how solve don't need shutdown second app first 1 able acquire sockets (which -i know - free).

this normal handle inheritance behavior. unfortunately .net process.start passing true binherithandles createprocess (nb. open request allow control of behavior exists: make process.start have option change handle inheritance). work around, use native createprocess instead, see when system.diagnostics.process creates process, inherits inheritable handles parent process.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -