Hi,

I'm having trouble sending a string from one PC to another using the send_data_to or send_data_id commands, I've already posted here but had no replies.

How exactly (needs to be using send_data not send_string as I need to send additional information with the string) do I go about this.

So far I've tried
typedef struct DATA {

int id;
int type;

// char name; //gives me a one char garbled message (as expected) from server to client
// char* name; //sends the correct message, but receives only 1 char, no chars, or crashes client
// char* name; //sending with _chr(msg.name), repeats the above, but never with a crash

// char name[20]; //sends unreadable string using _chr or _str
// char* name[20]; //sends unreadable string

STRING* name; //sends correct message, crashes client
//all messages shown for sending and receiving via update_log()
} DATA;

DATA msg;

here's the code I'm using
Code:
// MP_woes.c

#include <acknex.h>
#include <default.c>

typedef struct DATA {
	
	int id;
	int type;
	
//	char name; //gives me a one char garbled message (as expected) from server to client
//	char* name; //sends the correct message, but receives only 1 char, no chars, or crashes client
//	char* name; //sending with _chr(msg.name), repeats the above, but never with a crash 
	
//	char name[20]; //sends unreadable string using _chr or _str
//	char* name[20]; //sends unreadable string
	
	STRING* name; //sends correct message, crashes client
	
} DATA;

DATA msg;


#define DATA_SERVER_JOIN 1
#define DATA_SERVER_LEFT 2


#define players_max 8

int int_player_count;

var player_id[players_max];

TEXT* txt_players = {
	
	strings = 8;
	flags = SHOW;
}

TEXT* txt_eventlog = {
	
	pos_x = 200;
	strings = 40;
	flags = SHOW;
}


void set_names(STRING* str){
	
	(txt_players.pstring)[int_player_count] = str;
//	str_cpy((txt_players.pstring)[int_player_count], str);
	int_player_count++;
}

void get_names(){
	
}


void update_log(STRING* str){
	
/*	int i;
	for(i = 0; i < txt_eventlog.strings - 1; i++){
		
		str_cpy((txt_eventlog.pstring)[i], (txt_eventlog.pstring)[i+1]);
	}
	str_cpy((txt_eventlog.pstring)[txt_eventlog.strings - 1], str);
*/	int i;
	for(i = 0; i < txt_eventlog.strings - 1; i++){
		
		(txt_eventlog.pstring)[i] = (txt_eventlog.pstring)[i+1];
	}
	(txt_eventlog.pstring)[txt_eventlog.strings - 1] = str;
}


void client_event(void* str){
	
	update_log("CLIENT EVENT");
	
	switch(event_type){
		
		case EVENT_JOIN:
			
			update_log(" - EVENT JOIN");
			update_log("(me)");
			
			//update you when connection made
			set_names(player_name);
			
			//send client name
			
			
		break;
		
		case EVENT_LEAVE:
			
			update_log(" - EVENT LEAVE");
			update_log("(me)");
			
		break;
		
		case EVENT_VAR:
			
			update_log(" - EVENT VAR");
			
		break;
		
		case EVENT_STRING:
			
			update_log(" - EVENT STRING");
			
		break;
		
		case EVENT_DATA:
			
			update_log(" - EVENT DATA");
			
			memcpy(msg, str, sizeof(DATA));
			
			switch(msg.type){
				
				case DATA_SERVER_JOIN:
					
					update_log(" - DATA JOIN");
					
					set_names(msg.name);
					
				break;
				
				default:
				
					update_log(" - DATATYPE UNKNOWN");
				break;
			}
			
		break;
		
		default:
			
			update_log(" - EVENT UNKNOWN");
			
		break;
	}
}


void server_event(void* str, var id){
	
	update_log("SERVER EVENT");
	
	switch(event_type){
		
		case EVENT_JOIN:
			
			update_log(" - EVENT JOIN");
			update_log(str);
			
			//send current players to new player
			int i;
			for(i = 0; i < int_player_count; i++){
				
				msg.id = id;
				msg.type = 1;
				msg.name = "STEVE";//_chr((txt_players.pstring)[i]);
				
				send_data_id(id, msg, sizeof(DATA));
				
				update_log(" - SENT -");
				update_log(msg.name);
			}
			
			//add to server
			set_names(str);
			
			//add me to player list
			
		break;
		
		case EVENT_LEAVE:
			
			update_log(" - EVENT LEAVE");
			
		break;
		
		case EVENT_VAR:
			
			update_log(" - EVENT VAR");
			
		break;
		
		case EVENT_STRING:
			
			update_log(" - EVENT STRING");
			
		break;
		
		case EVENT_DATA:
			
			update_log(" - EVENT DATA");
			
		break;
	}
	
}

void main(){
	
	int i;
	for(i = 0; i < txt_eventlog.strings; i++){
//		(txt_eventlog.pstring)[i] = str_create("");
	}
	
	on_client = client_event;
	on_server = server_event;
	
	wait(1);
	
	//if host
	if(connection == 3){
		
		set_names(player_name);
	}
	
	//if server / host
	if(connection & 1){
		
	}
	
	//if client / host
	if(connection & 2){
		
	}
	
	update_log("MAIN");
	
}

any insight would be appreciated

NB: you can probably already see I've tried using str_create, str_cpy for the log, but unsure which if i should be using = or str_cpy, both seem to have advantages and disadvantages.

I am able to workaround atm by doing string manipulation before sending and after receving using send_string, but would prefer to use the send_data method.

Many thanks
MrGuest