Comments (9)
Hello,
By changing a couple of lines I solved it.
in Server.php
private string $host;
private int $port;
then,
$this->host = $host;
$this->port = $port;
then,
if (substr(php_uname(), 0, 7) == "Windows"){
$this->icpSocket = socket_create(AF_INET, SOCK_DGRAM, 0);
$ipcSocketPath = $this->host;
} else {
if (file_exists($ipcSocketPath)) {
unlink($ipcSocketPath);
}
$this->icpSocket = socket_create(AF_UNIX, SOCK_DGRAM, 0);
}
then,
if (substr(php_uname(), 0, 7) == "Windows") {
$from = '';
$port = 0;
$bytesReceived = socket_recvfrom($this->icpSocket, $buffer, 65536, 0, $from, $port);
} else {
$bytesReceived = socket_recvfrom($this->icpSocket, $buffer, 65536, 0, $this->ipcSocketPath);
}
in Application.php
, removed final
at line 19
Thanks a lot.
from php-websocket.
Hello,
I do not use any windows machines so I can not test this but it seems to be a problem with your hosts configuration. Please see: https://stackoverflow.com/questions/2370388/socketexception-address-incompatible-with-requested-protocol
from php-websocket.
Just found out that SOCK_DGRAM is not supported in Windows. The code has to be modified to enable support for windows.
Reference: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
from php-websocket.
Could you share your changes? Maybe I can include them in the next version.
from php-websocket.
This is my problem and I could not fix any action I had to do and I had to use the old versions
from php-websocket.
Can you please try to change
$this->icpSocket = socket_create(AF_UNIX, SOCK_DGRAM, 0);
to
$this->icpSocket = socket_create(AF_UNIX, SOCK_STREAM, 0);
and check if that works on a windows machine?
from php-websocket.
Can you please try to change
$this->icpSocket = socket_create(AF_UNIX, SOCK_DGRAM, 0);
to
$this->icpSocket = socket_create(AF_UNIX, SOCK_STREAM, 0);
and check if that works on a windows machine?
No
from php-websocket.
Hello! @MasumNishat solution works. Could you add it in the new version?
from php-websocket.
@MasumNishat If you create a pull-request I'm happy to merge these changes into a new release.
from php-websocket.
Related Issues (20)
- how to send cert connect wss:// HOT 9
- Publish on packagist HOT 1
- Use php5 HOT 1
- How to keep long connection? HOT 1
- Server drops messages HOT 3
- StatusApplication may loose clients HOT 4
- Adding a Client.php Message Listener HOT 3
- WebSocketServer behind haproxy HOT 3
- Typo HOT 1
- socket_bind creates file in /tmp, but www-data has no permissions to it HOT 1
- Missing client documentation HOT 1
- Do not accept new connection after running for a while (+/- 1h)
- Can't set timer
- Class "Bloatless\WebSocket\Examples\Application\Chat" not found HOT 1
- PHP Warning: Private methods cannot be final as they are never overridden by other classes
- how to do private message using php-websocket Bloatless V2.0 ? HOT 2
- how to implement private chat in DemoApplication as in StatusAplication?
- Release v3.0.2 HOT 2
- Possibility to close a Websocket Server?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-websocket.