Added maxsize restriction in receive function.