title: Threadsafe class to send messages through socket
body: <p>I'm trying to implement a module that sends messages to a server via socket. It will be used in a multi threaded environment, so this "Client" object is shared among threads.
  My question is that should I use a lock block int the Send method to make this class threadsafe? (Probably yes, but I saw a lot of sample codes, where there isn't any locking.)</p>
  
  <p>Here is the simplified version of my <code>MessengerClient</code> class.</p>
  
  <pre><code>public class MessengerClient
  {
      private Socket socket;
      public MessengerClient()
      {
          socket = new Socket(SocketType.Stream, ProtocolType.IPv4);
      }
  
      public void Connect(string host, int port)
      {
          socket.Connect(host, port);
      }
  
      public void SendMessage(IMessage message)
      {
          var buffer = ObjectConverter.ConvertToByteArray(message);
  
          var args = new SocketAsyncEventArgs();
          args.Completed += args_Completed;
          args.SetBuffer(buffer, 0, buffer.Length);
  
          //lock (socket)
          //{
              socket.SendAsync(args);
          //}
      }
  }
  </code></pre>