-
Notifications
You must be signed in to change notification settings - Fork 56
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
I uploaded to live server and getting error socket_sendto(): Unable to write to socket [1]: Operation not permitted #35
Comments
i'm also facing same issue |
Send me code
…________________________________
From: ukhanPronto ***@***.***>
Sent: Tuesday, February 6, 2024 3:41 AM
To: raihanafroz/zkteco ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [raihanafroz/zkteco] I uploaded to live server and getting error socket_sendto(): Unable to write to socket [1]: Operation not permitted (Issue #35)
The application was working fine on localhost as soon as I uploaded it to live server it made an issue
socket_sendto(): Unable to write to socket [1]: Operation not permitted
—
Reply to this email directly, view it on GitHub<#35>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A3QBNQLGSIYKQMLQYJLX23TYSFKH7AVCNFSM6AAAAABC25JMPSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEYTSNJUHAYTSNQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Below is the code please let me know if you need anything else
|
required static IP
…________________________________
From: ukhanPronto ***@***.***>
Sent: Wednesday, February 14, 2024 10:23 PM
To: raihanafroz/zkteco ***@***.***>
Cc: 9822824952 ***@***.***>; Comment ***@***.***>
Subject: Re: [raihanafroz/zkteco] I uploaded to live server and getting error socket_sendto(): Unable to write to socket [1]: Operation not permitted (Issue #35)
Below is the code please let me know if you need anything else
` use Rats\Zkteco\Lib\ZKTeco;
public function test() {
$zk = new ZKTeco('192.168.18.100');
$zk->connect();
$usersData = $zk->getUser();
$attendancesData = $zk->getAttendance();
foreach($attendancesData as $attendance):
if(date('Y-m-d', strtotime($attendance['timestamp'])) >= date('Y-m-d')) {
print_r($attendance);
}
}
endforeach;`
}
—
Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A3QBNQM2K7QHMXDL3EPENSDYTTT2JAVCNFSM6AAAAABC25JMPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBUGIZDMNJQGQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
I have assigned static IP to the device. if not please guide me |
Send me device images
IP
Gateway
DNS
Cloud setting and port
…________________________________
From: ukhanPronto ***@***.***>
Sent: Thursday, February 15, 2024 9:48 PM
To: raihanafroz/zkteco ***@***.***>
Cc: 9822824952 ***@***.***>; Comment ***@***.***>
Subject: Re: [raihanafroz/zkteco] I uploaded to live server and getting error socket_sendto(): Unable to write to socket [1]: Operation not permitted (Issue #35)
I have assigned static IP to the device. if not please guide me
—
Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A3QBNQMUIRYBBTHWFOUB4GLYTYYOVAVCNFSM6AAAAABC25JMPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBWGQ3DEMZSGM>.
You are receiving this because you commented.Message ID: ***@***.***>
|
@9822824952 have you tested yourself from accessing outside the same network? if yes then please share how? |
You can only access this device within your Local Area Network (LAN). If you want to access the device from anywhere on the internet, you have to forward your device from the settings in your home router and even with that I assume you will only able to access it from your Wide Area Network only because your ISP will not allow forwarding. And ISP's uses complex internal network of multiple routers and switches. To verify that, first forward your device to WAN by going to your home router forwarding settings enter your zkteco device IP and put 4730 in service port and 4730 also in the internal port. And copy the WAN IP showing in your home router settings page. Now try access the device from your WAN IP first, if it works you have successfully forwarded your device to your WAN. Now get your public IP by visiting any what's my IP website. Compare your WAN IP with your Public IP if it's same then congrats you're a lucky person and your router is directly connected to the internet which will never going to happen. With WAN forwarding working, you can access the device from within your office building or within your street, area, etc. But not outside the network. And your zkteco device IP will change if router restarts or your device is reconnected to the network, for that you have to assign static IP to your device from your home router settings. Now what after WAN success? |
@erdum |
Try to check your firewall permissions. And also provide more detail about your environment, where your code is running? If it is running on a remote server, then what type of hosting? |
@erdum Also where exactly to check for firewall permissions? One more thing I want to mention here is that when I try to connect within ZKTECO's software i.e. ZKTime5.0 using my static IP and external port while being within the same network, the device gets connected. The library only connects when you are within the same network, using the internal network IP assigned to the device, and the port, if it's set to the default, i.e., 4370. |
@Ehtasham-CEF And if you are using Hostinger i.e., shared hosting there is no way directly you can access firewall with command line. Try to find firewall setting in your cPanel interface or similar, whichever you have. |
@erdum |
@erdum |
If you're saying this, then I am assuming that your forwarding is working. To better confirm it, connect your pc to a network other than the network to which your device is connected. Then use telnet to connect to your static IP If you're on Windows upon successful connection, your screen will clear, and you will see a blank screen on your cmd. If you're able to connect to your device from static_ip from outside your network, then the only thing which is stopping the remote server from accessing your device is server permission or disabled PHP socket module which can be given from CLI in case of virtual private server running Linux. I don't think we can modify permissions on the shared hosting with php_ini directives or with .htaccess file. |
@Ehtasham-CEF |
@erdum |
Look for "sockets" and "streams" in your phpinfo dump. |
@erdum |
Place this test script on your server, change the IP with your static IP and port according to your case, then try to run it and see if you're able to connect or not. Your phpinfo dump seems fine.
|
@Ehtasham-CEF |
@erdum Yes it is. |
@Ehtasham-CEF I think we're missing something, you need to debug your connect() method to see what parameters it is using when calling PHP native socket functions. |
@Ehtasham-CEF
|
@erdum |
@erdum |
@erdum |
Sorry, script was incorrect for testing UDP. I have removed them. Still, we have to verify that the server can establish a UDP connection over your static IP |
@erdum |
That script was not correct but still it verified that server is unable to send data. |
@erdum |
@Ehtasham-CEF I am creating a script to verify it, will share with you once it is ready. |
@Ehtasham-CEF
|
@erdum |
That's mean UDP traffic isn't allowed. You have to modify the library code to utilize TCP/IP instead of UDP. |
@Ehtasham-CEF |
@erdum |
I've never worked with these sockets stuff before😔 |
Does anyone make this thing work? I uploaded it in hosting but I got this same error . Pls help |
@ph4t0o0o0om |
@erdum I already read the discussion above. In your side have you modified the libary to make this work in hosting? |
@ph4t0o0o0om I started playing with it but not getting free time to properly make it run. But I have deeply explained to, so with little knowledge you can do this easily. And I am here for any help. |
any one found solution |
@Masarkah The problem is occurring only on shared hosting and for that you have to modify the code as I have mentioned above. |
This same error was happening to me and I was able to solve it in a very easy way. It happens that shared servers usually have outgoing UDP connections blocked by default. I just had to talk to my support to enable UDP connections through port 4730. and ready |
The application was working fine on localhost as soon as I uploaded it to live server it made an issue
socket_sendto(): Unable to write to socket [1]: Operation not permitted
The text was updated successfully, but these errors were encountered: