Am working on asynchronous socket programming and am using this code
Am dynamically creating these listeners(New instance of Socket Listener on each Port by passing different Port numbers and i need to pass an associated information for each port number when the socket is listening so i can use that information when i receive data.
basically my Start listening method will be like
public static void StartListening(string addInfo)
i understand how to pass additional parameter for Asynch function after referring this
https://stackoverflow.com/a/9192678/1481690
but in this socket code we already passing socket as a parameter (Listener)
listener.BeginAccept(
new AsyncCallback(AcceptCallback),
listener );
How do i add one more additional Parameter i need to pass on to BeginAccept?
what other ways i can get this to work as we already have a socket(Listener) object sent as a parameter.
or how else can i dynamically ramp up the socket servers with different ports and some how i can map additional Info to each Socket