A controller configured to control a switch in a communications network, wherein the controller is configured to transmit to the switch a plurality of flow modification messages comprising flow data for routing flows through the switch; wherein the controller comprises: an identifier providing unit arranged to provide an identifier in each flow modification message; a receiving unit configured to receive a resynchronization message from the switch upon reestablishment of communications between the controller and the switch after a loss of connectivity, wherein the resynchronization message comprises an identifier indication for indicating a said identifier of the flow modification message most recently received by the switch; a determining unit configured to determine which one or more of the flow modification message(s) have not been received by the switch based on the received identifier indication, wherein the determining unit is configured to determine if all transmitted flow modification messages have been received by the switch by comparing the identifier indication with an identifier of a most recently transmitted flow modification message; a retransmission unit configured to retransmit the one or more flow modification messages determined not to have been received by the switch; characterized in that the controller further configured to determine whether the resynchronization message comprises said identifier indication, and, if not, to resynchronize a switch state and a controller state by a complete exchange of flow table data between the switch and the controller by a complete exchange of flow table data by sending a flow data request to the switch, receiving flow data from the switch, and record the flow data in a history or, to resynchronize a switch state and a controller state by a complete exchange of flow table data by sending a flow delete message to the switch and re-sending to the switch each flow modification message. an identifier providing unit arranged to provide an identifier in each flow modification message; a receiving unit configured to receive a resynchronization message from the switch upon reestablishment of communications between the controller and the switch after a loss of connectivity, wherein the resynchronization message comprises an identifier indication for indicating a said identifier of the flow modification message most recently received by the switch; a determining unit configured to determine which one or more of the flow modification message(s) have not been received by the switch based on the received identifier indication, wherein the determining unit is configured to determine if all transmitted flow modification messages have been received by the switch by comparing the identifier indication with an identifier of a most recently transmitted flow modification message; a retransmission unit configured to retransmit the one or more flow modification messages determined not to have been received by the switch; characterized in that the controller further configured to determine whether the resynchronization message comprises said identifier indication, and, if not, to resynchronize a switch state and a controller state by a complete exchange of flow table data between the switch and the controller by a complete exchange of flow table data by sending a flow data request to the switch, receiving flow data from the switch, and record the flow data in a history or, to resynchronize a switch state and a controller state by a complete exchange of flow table data by sending a flow delete message to the switch and re-sending to the switch each flow modification message. to resynchronize a switch state and a controller state by a complete exchange of flow table data between the switch and the controller by a complete exchange of flow table data by sending a flow data request to the switch, receiving flow data from the switch, and record the flow data in a history or, to resynchronize a switch state and a controller state by a complete exchange of flow table data by sending a flow delete message to the switch and re-sending to the switch each flow modification message.