added some socketstream code