void rfbProcessUDPInput ( rfbScreenInfoPtr rfbScreen ) {
 int n ;
 rfbClientPtr cl = rfbScreen -> udpClient ;
 rfbClientToServerMsg msg ;
 if ( ( ! cl ) || cl -> onHold ) return ;
 if ( ( n = read ( rfbScreen -> udpSock , ( char * ) & msg , sizeof ( msg ) ) ) <= 0 ) {
 if ( n < 0 ) {
 rfbLogPerror ( "rfbProcessUDPInput: read" ) ;
 }
 rfbDisconnectUDPSock ( rfbScreen ) ;
 return ;
 }
 switch ( msg . type ) {
 case rfbKeyEvent : if ( n != sz_rfbKeyEventMsg ) {
 rfbErr ( "rfbProcessUDPInput: key event incorrect length\n" ) ;
 rfbDisconnectUDPSock ( rfbScreen ) ;
 return ;
 }
 cl -> screen -> kbdAddEvent ( msg . ke . down , ( rfbKeySym ) Swap32IfLE ( msg . ke . key ) , cl ) ;
 break ;
 case rfbPointerEvent : if ( n != sz_rfbPointerEventMsg ) {
 rfbErr ( "rfbProcessUDPInput: ptr event incorrect length\n" ) ;
 rfbDisconnectUDPSock ( rfbScreen ) ;
 return ;
 }
 cl -> screen -> ptrAddEvent ( msg . pe . buttonMask , Swap16IfLE ( msg . pe . x ) , Swap16IfLE ( msg . pe . y ) , cl ) ;
 break ;
 default : rfbErr ( "rfbProcessUDPInput: unknown message type %d\n" , msg . type ) ;
 rfbDisconnectUDPSock ( rfbScreen ) ;
 }
 }
void rfbProcessUDPInput ( rfbScreenInfoPtr rfbScreen ) {
 int n ;
 rfbClientPtr cl = rfbScreen -> udpClient ;
 rfbClientToServerMsg msg ;
 if ( ( ! cl ) || cl -> onHold ) return ;
 if ( ( n = read ( rfbScreen -> udpSock , ( char * ) & msg , sizeof ( msg ) ) ) <= 0 ) {
 if ( n < 0 ) {
 rfbLogPerror ( "rfbProcessUDPInput: read" ) ;
 }
 rfbDisconnectUDPSock ( rfbScreen ) ;
 return ;
 }
 switch ( msg . type ) {
 case rfbKeyEvent : if ( n != sz_rfbKeyEventMsg ) {
 rfbErr ( "rfbProcessUDPInput: key event incorrect length\n" ) ;
 rfbDisconnectUDPSock ( rfbScreen ) ;
 return ;
 }
 cl -> screen -> kbdAddEvent ( msg . ke . down , ( rfbKeySym ) Swap32IfLE ( msg . ke . key ) , cl ) ;
 break ;
 case rfbPointerEvent : if ( n != sz_rfbPointerEventMsg ) {
 rfbErr ( "rfbProcessUDPInput: ptr event incorrect length\n" ) ;
 rfbDisconnectUDPSock ( rfbScreen ) ;
 return ;
 }
 cl -> screen -> ptrAddEvent ( msg . pe . buttonMask , Swap16IfLE ( msg . pe . x ) , Swap16IfLE ( msg . pe . y ) , cl ) ;
 break ;
 default : rfbErr ( "rfbProcessUDPInput: unknown message type %d\n" , msg . type ) ;
 rfbDisconnectUDPSock ( rfbScreen ) ;
 }
 }