Re: Accessing the socket in the smtp server - WeOnlyDo Discussion board

Re: Accessing the socket in the smtp server (wodSmtpServer / wodPop3Server / wodImapServer)

by Nigel, Friday, August 13, 2010, 19:45 (5061 days ago)

Hi,
I looked in all the events and yes, I can capture what is going on for a user in there but what if I have several threads running at the same time? How can I log an individual threads data to be able to distinguish it from another thread? This is why I use the socket number. My log (which is a text file) looks like:
[2452] SMTP: Connect from 187.6.216.231
[00:59:08]
[2452] SMTP: 13/08/2010 00:59:08-Spawning server thread handle=1476..
[00:59:08]
[2452] SMTP: Sending 'service ready' to receiver on socket..
[00:59:09]
[2452] SMTP: Closing connection on socket ..
[00:59:13]
[2452] SMTP: EXITING thread for socket ..
[00:59:13]
[2324] SMTP: Connect from 94.25.124.194
[00:59:13]
[2324] SMTP: 13/08/2010 00:59:13-Spawning server thread handle=2452..
[00:59:13]
[2324] SMTP: Sending 'service ready' to receiver on socket..
[00:59:14]
[2324] SMTP: (State=1) on socket Got HELO mncctj
[00:59:27]
[2324] SMTP: (State=2) on socket Got MAIL FROM: <c_annie_xy@starnursery.com>
[00:59:31]
SMTP: Unauthorised user - rejecting connection attempt from <c_annie_xy@starnursery.com>..
[00:59:31]
550 SPAM Is not allowed on this server..
[00:59:31]
[2324] Socket closed
[00:59:31]
[2420] SMTP: Connect from 82.73.157.60
[00:59:36]
[2420] SMTP: 13/08/2010 00:59:36-Spawning server thread handle=2384..
[00:59:36]
[2420] SMTP: Sending 'service ready' to receiver on socket..
[00:59:36]
[2420] SMTP: (State=1) on socket Got HELO uxzbzu
[00:59:38]
[2420] SMTP: (State=2) on socket Got MAIL FROM: <kelsiechautr@fujitsugeneral.com>
[00:59:43]

As you can see, the socket is recorded ([2420] for example) for each thread so I can 'untangle' my log if necessary.


Complete thread: