Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New to reactphp : I think my problem is easy for you #294

Closed
sktechnology opened this issue Jun 20, 2022 · 3 comments
Closed

New to reactphp : I think my problem is easy for you #294

sktechnology opened this issue Jun 20, 2022 · 3 comments
Labels

Comments

@sktechnology
Copy link

sktechnology commented Jun 20, 2022

Hi, my miner is connecting to the port 8080, i just want to forward all tcp communication to my stratum on the port 3500, i want to see the communication.

I have read the documentation but my english is not very good i am french..

I have opened socketserver on the port 8080 and the miner is connecting to the stratum but i think i dont receive response back from.

this is my code, thx you for your help

$socket = new React\Socket\SocketServer('192.168.1.147:8080');
$connector = new React\Socket\Connector();

$socket->on('connection', function (React\Socket\ConnectionInterface $connection) {

 $connection->on('data', function ($data) use ($connection) {
     
     echo $data;
     $connection->write($data);
     
});

});

$connector->connect('192.168.1.147:3500')->then(function (React\Socket\ConnectionInterface $connection) {

     $connection->on('data', function ($data) use ($connection) {
     
     echo $data;
     $connection->write($data);
     
});

});

@SimonFrings
Copy link
Member

Hey @sktechnology, thanks for bringing this up 👍

I am not 100% sure what you're trying to achieve here. Maybe take a look at reactphp/http or clue/reactphp-http-proxy if you're using HTTP. You can also post your question at stackoverflow for more help.

I hope this helps as a starting point. If this is not the case, you can provide us some more information about your use case and your code input and the output you're receiving.

@sktechnology
Copy link
Author

sktechnology commented Jun 20, 2022

Hi @SimonFrings thx for your reply, i try to make communication beetween 2 socket. 1 socket is the server and waiting for connection when the connection is done the data need to be transfered to the second socket this socket connect to another port. the connexion is done by TCP, I dont know if i can use http for handle the data.

@clue clue added the question label Jun 21, 2022
@clue
Copy link
Member

clue commented Jun 21, 2022

@sktechnology Hi and welcome to @reactphp!

Your question is very broad at the moment, so I can only assume you're looking for the pipe() method to forward data from one connection to another connection in some kind of application that resembles a proxy server. If you can ask more specific questions, I'm sure this is something we can help with, but as it stands answering your question pretty much entails implementing your entire project. I also provide professional support, so I invite you to check out my profile if you're interested, but I'm sure you understand that this is somewhat out of scope for this issue tracker.

I hope this helps! 👍 I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can always reopen this 👍

@clue clue closed this as completed Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants