A medical device comprising a socket unit for connecting a plug unit of a device for providing medical fluids, wherein the socket unit has at least one connecting piece for connecting at least one connector of the plug unit so that when connecting the connector to the connecting piece, a flow connection for feeding fresh fluids or discharging used fluids between the medical device and the device for providing medical fluids can be established, characterized in that the socket unit has a connecting mechanism for establishing a connection between the at least one connecting piece (27, 28) and the at least one connector, wherein the connecting mechanism has a drive unit that has at least one movable drive body that carries out a translational or rotational movement, at least one position detection mechanism for detecting the linear position or the angular position of the drive body is provided, wherein the position detection mechanism comprises: at least two magnet elements (100, 110) that are arranged spaced apart from each other and generate a magnetic field, and at least two sensor elements (120, 130) that detect the magnetic field of the magnet elements, wherein the at least two magnet elements are arranged on the movable drive body and the at least two sensor elements are arranged stationarily in relation to the movable drive body, or the at least two magnet elements are arranged stationarily in relation to the movable drive body and the at least two sensor elements are arranged on the movable drive body, and an evaluation unit that is configured such that the linear position or the angular position of the drive body is determined based on the magnetic field generated by the at least two magnet elements (100, 110) and detected by the at least two sensor elements (120, 130), wherein the at least two magnetic elements (100, 110) of the position detection mechanism are at least a first magnet element and a second magnet element that are arranged spaced apart from each other with opposite polarity, and the at least two sensor elements (120, 130) of the position detection mechanism are at least a first sensor element and a second sensor element that are spaced apart from each other, wherein the evaluation unit is configured such that based on the magnetic field detected by the first sensor element, two possible linear positions or angular positions of the drive body are determined, and based of the magnetic field detected by the second sensor element, it is determined whether the linear position or angular position determined with the first sensor element is the first or the second linear position and/or angular position of the two possible positions and/or angular positions. at least two magnet elements (100, 110) that are arranged spaced apart from each other and generate a magnetic field, and at least two sensor elements (120, 130) that detect the magnetic field of the magnet elements, wherein the at least two magnet elements are arranged on the movable drive body and the at least two sensor elements are arranged stationarily in relation to the movable drive body, or the at least two magnet elements are arranged stationarily in relation to the movable drive body and the at least two sensor elements are arranged on the movable drive body, and an evaluation unit that is configured such that the linear position or the angular position of the drive body is determined based on the magnetic field generated by the at least two magnet elements (100, 110) and detected by the at least two sensor elements (120, 130), wherein the at least two magnetic elements (100, 110) of the position detection mechanism are at least a first magnet element and a second magnet element that are arranged spaced apart from each other with opposite polarity, and the at least two sensor elements (120, 130) of the position detection mechanism are at least a first sensor element and a second sensor element that are spaced apart from each other, wherein the evaluation unit is configured such that based on the magnetic field detected by the first sensor element, two possible linear positions or angular positions of the drive body are determined, and based of the magnetic field detected by the second sensor element, it is determined whether the linear position or angular position determined with the first sensor element is the first or the second linear position and/or angular position of the two possible positions and/or angular positions.