added socketdata function to twi