Sorry for the late response, but I was on holiday.
The problem occurs the first time a user enters the game room and tries to send messages to the server via the UDP protocol. The server receives the messages, because it shows a warning for every message:
Code: Select all
11:54:41,649 WARN [SocketReader] protocol.SFSIoHandler - Discard UDP packet from 127.0.0.1:60359, reason: User does not exist, id: -1
The UDP protocol works fine though if messages are sent from the server to the client. The error disappears if the user disconnects and connects (and enters the room) again. The problem only occurs the very first time a client joins the room after a server restart.
This is the code I use to connect to a room and send UDP packages:
Code: Select all
- (void)onLogin:(SFSEvent *)evt
{
// Initialize the UDP socket
[smartFox initUDP:nil:-1];
}
Code: Select all
- (void)joinRoom:(NSString *)room
{
[smartFox send:[JoinRoomRequest requestWithId:room]];
}
Code: Select all
- (void)send:(NSString *)msg useUDP:(BOOL)useUDP
{
// Create SFS Data object
id data = [[SFSObject newInstance] autorelease];
// Store data in SFS Data object
// ...
// Send via SFS
[smartFox send:[ExtensionRequest requestWithExtCmd:CMD params:data room:[smartFox lastJoinedRoom] udp:useUDP]];
}
More logs:
Code: Select all
13:56:15,914 INFO [main] v2.SmartFoxServer -
_____ _____ _____ ___ __ __
| __| __| __| |_ | | |
|__ | __|__ | | _|- -|
|_____|__| |_____| |___|__|__|
_____ _____ _____ ____ __ __
| __ | __| _ | \| | |
| -| __| | | |_ _|
|__|__|_____|__|__|____/ |_|
[ 2.0.1 ]
13:56:15,916 INFO [main] v2.SmartFoxServer - SmartFoxServer 2X (2.0.1) READY!
13:56:18,286 INFO [SocketReader] core.SocketAcceptor - Session created: { Id: 1, Type: DEFAULT, Logged: No, IP: 192.168.100.68:63807 } on Server port: 9933 <---> 63807
13:56:19,568 INFO [pool-1-thread-3] api.SFSApi - Login in, { Zone: LF }, ( User Name: jonas, Id: 0, Priv: 0, Sess: 192.168.100.68:63807 )
13:56:22,839 WARN [SocketReader] protocol.SFSIoHandler - Discard UDP packet from 192.168.100.68:49603, reason: User does not exist, id: -1
13:56:22,867 WARN [SocketReader] protocol.SFSIoHandler - Discard UDP packet from 192.168.100.68:49603, reason: User does not exist, id: -1
13:56:22,918 WARN [SocketReader] protocol.SFSIoHandler - Discard UDP packet from 192.168.100.68:49603, reason: User does not exist, id: -1
13:56:22,976 WARN [SocketReader] protocol.SFSIoHandler - Discard UDP packet from 192.168.100.68:49603, reason: User does not exist, id: -1
13:56:23,189 WARN [SocketReader] protocol.SFSIoHandler - Discard UDP packet from 192.168.100.68:49603, reason: User does not exist, id: -1
13:56:28,683 INFO [SocketReader] sessions.DefaultSessionManager - Session removed: { Id: 1, Type: DEFAULT, Logged: Yes, IP: 192.168.100.68:63807 }
13:56:28,684 INFO [SocketReader] entities.SFSZone - User: jonas was disconnected.
13:56:28,685 INFO [SocketReader] api.SFSApi - User disconnected: ( User Name: jonas, Id: 0, Priv: 0, Sess: 192.168.100.68:63807 )
It looks like the ports aren't the same (63807 <-> 49603)