Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <socket>
- new Socket:clientsocket;
- main() {
- print("\n----------------------------------");
- print(" Socket Cliente");
- print("----------------------------------\n");
- }
- public OnGameModeInit() {
- clientsocket=socket_create(TCP);//cria um socket
- if(is_socket_valid(clientsocket))//verifica se criou
- {
- socket_connect(clientsocket, "127.0.0.1",54678);//conecta ao socket server
- socket_send(clientsocket, "Eu sou o socket cliente e conectei ao socket server!\n",24);//envia mensagem
- }
- return 1;
- }
- public onSocketAnswer(Socket:id, data[], data_len) {//quando receber resposta do socket server
- printf("socketid %d | mensagem %s | total carateres %d",_:id,data,data_len);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement