| View previous topic :: View next topic |
| Author |
Message |
lgnr
Joined: 17 Dec 2009 Posts: 39
|
Posted: Sat Jan 30, 2010 8:52 am Post subject: Best way to send key presses/releases through socket |
|
|
Hi everyone.
I'm trying to create an simple app to send key presses/releases to be interpreted using WinAPI. Everything went fine, its all working. But now i've run into this problem:
I'm using SceCtrlLatch to get the changes on key states and send the 'events' (presses and releases) throught a simple UDP socket.
The problem is sometimes when you press two keys at the 'same' time (or in a short time) it does not send that packet or psp does not recongnize that.If that is a key release, it becomes really anoying, cause if you're running an emulator, it does not get the key release and mario keeps running foward, for example.
So my question is: what is the best way of doing it? Should i send them over TCP or anything like that?
Thanks in advance. |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Sun Jan 31, 2010 1:51 am Post subject: |
|
|
| Application layer wifi is not suitable for sending keypresses in the first place. You will lose something. |
|
| Back to top |
|
 |
victorprosa
Joined: 14 Jan 2009 Posts: 38
|
Posted: Sun Jan 31, 2010 2:04 am Post subject: |
|
|
| Torch wrote: | | Application layer wifi is not suitable for sending keypresses in the first place. You will lose something. |
Except if the PSP client sends like 5 times the single key press information in for example 100ms...
in reciever, you configure it to ignore key repeat in a 100ms interval...
Information loss problem solved? xD |
|
| Back to top |
|
 |
m0skit0
Joined: 02 Jun 2009 Posts: 226
|
Posted: Sun Jan 31, 2010 2:17 am Post subject: |
|
|
You shouldn't use UDP if you're going to merely transmit keystrokes. Use TCP instead. Here a few hints about why to do so:
http://en.wikipedia.org/wiki/Transmission_Control_Protocol#Data_transfer
| Torch wrote: | | Application layer wifi is not suitable for sending keypresses in the first place. You will lose something. |
I completely disagree. How can you play games over ad-hoc Wifi then? TCP is a reliable protocol. You don't have to lose a single thing. _________________
| The Incredible Bill Gates wrote: | | The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers. |
|
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Sun Jan 31, 2010 4:04 am Post subject: |
|
|
| m0skit0 wrote: | | I completely disagree. How can you play games over ad-hoc Wifi then? TCP is a reliable protocol. You don't have to lose a single thing. |
Games send updates of the game state, not button presses. And much much less frequently than button sampling rate. There is no way you can play something like Tekken if it sent button presses, where there are moves that require timing accurate up to 1/60th of a second known as just frame or single frame moves. Buttons are interpreted on the client side and only the resulting application action is sent to the server. |
|
| Back to top |
|
 |
m0skit0
Joined: 02 Jun 2009 Posts: 226
|
Posted: Sun Jan 31, 2010 4:07 am Post subject: |
|
|
(PLZ DELETE) _________________
| The Incredible Bill Gates wrote: | | The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers. |
|
|
| Back to top |
|
 |
lgnr
Joined: 17 Dec 2009 Posts: 39
|
Posted: Wed Feb 17, 2010 2:49 am Post subject: |
|
|
Thanks for every answer. It was really helpful.
But the question is another:
The PSP CANNOT read every key press if there are too many at the same time.
I mean, i found that is not reliable to send one key press when the key is pressed.
Perhaps it would be nicier to send all the key states instead of each button at a time?
Any thoughts on that, guys?
Thanks a lot again! |
|
| Back to top |
|
 |
m0skit0
Joined: 02 Jun 2009 Posts: 226
|
Posted: Wed Feb 17, 2010 3:26 am Post subject: |
|
|
Send game status or better, only modifications that had ocurred. Do not send keypresses, process them and send game status as Torch already explained. _________________
| The Incredible Bill Gates wrote: | | The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers. |
|
|
| Back to top |
|
 |
|