Alright, I can send a message (TCP) to a newly joined player, however, sending a message back is givving me errors.
Server Code: (Part of the update function)
// New Clients
// If the client has just connected to the server and needs innitial data before proceeding
// to the 'normal' data stream of the running game.
client_count# = array count(client(0))
for ID = 1 to client_count#
if client(ID).mode# = 0
// Send Packet
// Server Name
size# = len(server_name$)
mn add string send_packet, server_name$, size#, 1
// Send the Packet (mn encrypt)
mn send tcp instances#, send_packet, ID, 1, 0
// Receive Packet (mn encrypt)
TCP_packets = mn recv tcp(instances#, receive_packet, ID)
// Client Name
client(ID).name$ = mn get string (receive_packet, 0, 1)
// Program Report en Program Log
program_report$ = "Client Name: " + client(ID).name$ : program_report()
if program_log# = 1 then write datafile string program_log_file#, program_report$
// Client Mode
client(ID).mode# = 1
endif
next ID
Client Code: (Part of the update function)
// If the client has just connected to the server and needs innitial data before proceeding
// to the 'normal' data stream of the running game.
if client_mode# = 0
// Receive Packet (mn encrypt)
TCP_packets = mn recv tcp(0, receive_packet, NULL)
// Server Name
server_name$ = mn get string (receive_packet, 0, 1)
// Send Packet
// Client Name
size# = len(client_name$)
mn add string send_packet, client_name$, size#, 1
// Send the Packet (mn encrypt)
mn send tcp instances#, send_packet, ID, 1, 0
// Program Report en Program Log
program_report$ = "Server Name: " + server_name$ : program_report()
if program_log# = 1 then write datafile string program_log_file#, program_report$
// Client Mode
client_mode# = 1
endif
Probably because it is using sending and receiving at the same time... just a guess though. Any suggestions?
Thanks!
Regards Sph!nx
www.mental-image.net