|
Forums -> Security Library Forum
AcceptSocket in a windows service problem |
|
|
by Michael [mpark at springstnet dot com] posted on 2003/11/25 |
|
I'm converting my console application to a windows service and am starting a new thread from my service OnStart event to handle incoming sockets. Unfortunately I get an error on the BeginAccept method in the SecureSocket for some reason. Can anyone help or have an example of setting up a SecureTcpListener as a windows service?
Here is the sample code
private SecureTcpListener sslListener;
...
protected override void OnStart(string[] args)
{
...
threadAcceptConnections = new Thread(new ThreadStart(AcceptConnections));
threadAcceptConnections.Start();
...
}
private void AcceptConnections()
{
sslListener.Start();
while (true)
{ //Below is where the error occurs
SecureSocket soTcp = sslListener.AcceptSocket();
|
by Mike [mpark at springstnet dot com] posted on 2003/11/25 |
|
I've been able to isolate the problem a little more,
on the SecureTcpListener.Start() method
{"Only one usage of each socket address (protocol/network address/port) is normally permitted" }
StackTrace " at System.Net.Sockets.Socket.Bind(EndPoint localEP)\r\n at Org.Mentalis.Security.Ssl.VirtualSocket.Bind(EndPoint localEP)\r\n at Org.Mentalis.Security.Ssl.SecureTcpListener.Start()\r\n at SpringStreetNetworks.FlapService.AcceptConnections()" |
by Mike [mpark at springstnet dot com] posted on 2003/11/25 |
|
Never mind, it turns out that IIS had taken my port when I installed the SSL certificate. |
|
|