Giter Club home page Giter Club logo

Comments (5)

sdssaeq avatar sdssaeq commented on May 24, 2024
#include <stdio.h>
#include <enet/enet.h>
int main() {
	if (enet_initialize() != 0) {
		fprintf(stderr, "Can't initialize ENet\n");
		return EXIT_FAILURE;
	}
	ENetHost* host = enet_host_create(NULL, 1, 1, 0, 0);
	if (!host) {
		fprintf(stderr, "Can't create host\n");
		return EXIT_FAILURE;
	}
	const char* proxy_host_ip = "mysocks5";
	ENetSocks5Config config;
	config.address.port = 9187;

	if (enet_address_set_host_ip(&config.address, proxy_host_ip)) {
		fprintf(stderr, "Can't bind address to %s\n", proxy_host_ip);
		return EXIT_FAILURE;
	}
	strcpy(config.username, "myuser");
	strcpy(config.password, "mypw");
	if (enet_host_use_socks5(host, &config)) {
		fprintf(stderr, "Can't bind host to socks5\n");
		return EXIT_FAILURE;
	}

	ENetAddress address;
	enet_address_set_host(&address, "213.179.209.168");
	address.port = 17198;

	const char* target_ip = "213.179.209.168"; // for example we want to connect to 69.420.69.420
	if (enet_address_set_host_ip(&address, target_ip) != 0) {
		fprintf(stderr, "Can't set address host ip to %s\n", target_ip);
		return EXIT_FAILURE;
	}

	printf("Client ready\n");
	host->checksum = enet_crc32;
	//host->enableLogging = 1;
	enet_host_compress_with_range_coder(host);
	enet_host_set_using_new_packet(host, 1);

	ENetPeer* Kon = enet_host_connect(host, &address, 1, 0);
	if (Kon == NULL)
	{
		printf("No available peers for initiating an ENet connection.\n");
		exit(EXIT_FAILURE);
	}
	enet_host_flush(host);


	ENetEvent event;
	while (1) {
		while (enet_host_service(host, &event, 10) > 0) {
			printf("Received event: %d\n", event.type);
			switch (event.type)
			{
			case ENET_EVENT_TYPE_NONE:
				printf("No event???\n");
				break;
			case ENET_EVENT_TYPE_CONNECT:
				printf("Connecting??\n");
				break;
			case ENET_EVENT_TYPE_DISCONNECT:
				printf("Dc??\n");
				break;
			case ENET_EVENT_TYPE_RECEIVE:
				printf("Signal??\n");
				enet_packet_destroy(event.packet);
				break;
			default:
				printf("??\n");
				break;
			}
		}
	}
}

from enet-socks5.

sdssaeq avatar sdssaeq commented on May 24, 2024

image

from enet-socks5.

sdssaeq avatar sdssaeq commented on May 24, 2024

if i delete the comment these, its connected to the server
image

        const char* proxy_host_ip = "mysocks5";
	ENetSocks5Config config;
	config.address.port = 9187;

	if (enet_address_set_host_ip(&config.address, proxy_host_ip)) {
		fprintf(stderr, "Can't bind address to %s\n", proxy_host_ip);
		return EXIT_FAILURE;
	}
	strcpy(config.username, "myuser");
	strcpy(config.password, "mypw");
	if (enet_host_use_socks5(host, &config)) {
		fprintf(stderr, "Can't bind host to socks5\n");
		return EXIT_FAILURE;}

from enet-socks5.

zKevz avatar zKevz commented on May 24, 2024

That seems correct, but i don't know why yours are not working, maybe gt shadowbans your proxy? Mines are working fine

from enet-socks5.

aliersahan avatar aliersahan commented on May 24, 2024

the peer go CONNECTING state then disconnect
can help?

from enet-socks5.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.