Freeciv-3.2
Loading...
Searching...
No Matches
Functions
clinet.h File Reference

Go to the source code of this file.

Functions

int connect_to_server (const char *username, const char *hostname, int port, char *errbuf, int errbufsize)
 
void make_connection (int socket, const char *username)
 
void input_from_server (int fd)
 
void input_from_server_till_request_got_processed (int fd, int expected_request_id)
 
void disconnect_from_server (bool leaving_sound)
 
double try_to_autoconnect (void)
 
void start_autoconnecting_to_server (void)
 

Function Documentation

◆ connect_to_server()

int connect_to_server ( const char username,
const char hostname,
int  port,
char errbuf,
int  errbufsize 
)

Connect to a freeciv-server instance – or at least try to. On success, return 0; on failure, put an error message in ERRBUF and return -1.

Definition at line 249 of file clinet.c.

Referenced by client_start_server(), connect_callback(), connect_callback(), and fc_client::slot_connect().

◆ disconnect_from_server()

void disconnect_from_server ( bool  leaving_sound)

◆ input_from_server()

void input_from_server ( int  fd)

This function is called when the client received a new input from the server.

Definition at line 411 of file clinet.c.

Referenced by get_net_input(), gui_event_loop(), gui_event_loop(), and fc_client::server_input().

◆ input_from_server_till_request_got_processed()

void input_from_server_till_request_got_processed ( int  fd,
int  expected_request_id 
)

This function will sniff at the given fd, get the packet and call client_packet_input. It will return if there is a network error or if the PACKET_PROCESSING_FINISHED packet for the given request is received.

Definition at line 447 of file clinet.c.

Referenced by wait_till_request_got_processed().

◆ make_connection()

void make_connection ( int  sock,
const char username 
)

Called after a connection is completed (e.g., in try_to_connect).

Definition at line 275 of file clinet.c.

Referenced by try_to_connect().

◆ start_autoconnecting_to_server()

void start_autoconnecting_to_server ( void  )

Start trying to autoconnect to freeciv-server. Calls get_server_address(), then arranges for try_to_autoconnect(), which calls try_to_connect(), to be called roughly every AUTOCONNECT_INTERVAL milliseconds, until success, fatal error or user intervention.

Definition at line 553 of file clinet.c.

Referenced by set_client_state().

◆ try_to_autoconnect()

double try_to_autoconnect ( void  )

Make an attempt to autoconnect to the server. It returns number of seconds it should be called again.

Definition at line 498 of file clinet.c.

Referenced by gui_event_loop(), gui_event_loop(), and real_timer_callback().