Giter Club home page Giter Club logo

Comments (58)

kirillzyusko avatar kirillzyusko commented on August 30, 2024

It seems like some data is missing. I think it's race condition (where you start sending file before actual receiving). That's why some files may look like corrupted.

Try to add delay before sending file. I think ~300ms is enough.

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

300ms is not working.
Also after 3secs i am geeting error as below
Screenshot_20200708-011057_PassOn

Sometimes long waiting its working but no guarantee sometimes this error is coming..

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Can you share your code?

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

Dear Kirill,

I have sent my app.js via gmail to your gmail.. please check.

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

@sandipchandra17 You sent me almost identical code from my example project. Which flow isn't working there?

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

As i told different types of error like below scenario:

  1. Testing in two mobile android 9 and another android 6.
    Clicked receive msg in receiver mobile -> clicking on send messege on sender mobile, its saying files successfully received in receiver mobile but nothing received.
  2. Sometimes clicking on send msg from sender mobile and receiver mobile received as exif in alert. Screenshot attached.
  3. Send msd>receive msg sucessful and receive file fine but after that when clicking send file msg successfully received but file received damaged or half file.
  4. If first time connect issue occurs then nothing will happed msg or file send.. i have to again remove group then problem solved but have to wait for long time but no gurantee above points occuring almost 80% case.

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024
  1. I think it's impossible. "successful" means no error occurred in Java code. So file should be in a place.
  2. It seems, like stream of bytes was interrupted or you are trying to send the message not in UTF8. I need to have a look on Java logs. I can not say anything without them.
  3. That would be nice if you could re-create this scenario in code. By promise chaining. In this case I can reproduce it. During my testing everything worked fine.
  4. If you can not connect, then it's no sense to try to send messages/files. Or I misunderstood the description.

To sum it up: that would be nice, if you could share real example of code. Right now it sound too abstract and I can not even reproduce these issues. As a result I can nit help you nevertheless I want...
So sharing code snippet would be really nice.

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

This is the same code i sent you in gmail.

  1. In this scenario why received file message would come when i click on send messge. It should come as message received successfully.
  2. I am sending normal string message if you can look my code send message method.
  3. Sometimes its working fine sometimes not may be time gap issue.. but in real life application how do i know what time i have to put..
  4. Agreed. I will check again using debug mode.. may be same time gap issue.
  5. Found another issue: group formed sucessfully but while sending msg getting the below error:
    Screenshot_20200709-002407_PassOn

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

The code that you sent me presented in format button -> handler. You haven't provided a full history of all actions that you performed/buttons that you pressed. I am asking for small piece of code. Can you create your own button (like "Reproduce Issue 1") and make handler for it, where I will see all methods, which you are calling and the order of these methods?

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

Sorry I dont get your point.. what do you mean by firmat button-handler. I am testing same file you provided in the site..
My scenario is I have generated apk file from that code and installed in two mobiles. Then the process you mentioned I am doing

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

When I tested everything was fine, even with multiple message sending.
At least you are trying to send messages two times, right?
Can you put this business logic into separated function, and create special button for calling this method?
And provide this code here?

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

I havnt started any logic on your code yet.
What I did is single click on below button clicks on the same code app.js you provided.. I dont know you tested but i am testing same code below scenario.

My steps only one click:
Create group in mobile 1
Investigate in mobile 2
Connect in mobile 2
Receive message in mobile 1
Send message in mobile 2 --- giving above errors exif and sometimes no msg received..in apk app is closing.
Receive file in mobile 1
Send file in mobile 2- sometimes ok sometimes corrupted file received sometimes nothing happens somtimes coming ????? Exif.

Is the java code having some timegap issue or android version before 9 not supported?

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Hm, did you call getConnectionInfo after connection established?

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

Yes I checked connection info and it was fine..
Today I tested again with some more time gap between steps and its working fine.. but how come end user will know how much have to wait..
So what I was thinking Is it possible from your java classes return some messages like when receive message arrived successfully in receiver mobile, sender will be notified so that app will allow him/her to proceed for file upload.. or if one file is still tranferring sender and receiver can get transfer status so that app can restrict to do further action until its finish operation through react native..

And another point can you please check in java classes as i dont know much java why sometimes send message giving " file received successfully" message. Is it same method used for both file and message.. I found this when the scenaio like if a file received half like damaged file then if i click receve msg->send message it is occuring..

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Hi @sandipchandra17
In fact your message gave me one interesting idea, why it may happen.
If I try to fix one bug and give you a branch (I won't publish these changes in npm but you will be able to install it from github) - can you test it and say, whether bug is persist?

Can you say, between which steps the increasing of time gap helped?
If it was after sendMessage/sendFile/receiveMessage/receiveFile, then probably I know where is the problem and have some ideas how to fix it. But I need your help in this case.

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

Ok I will test this more minutely.. will let you know..

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

I was thinking the point that rather than increasing time can we have live status exposed to both sender and received about message send to receiver or not informed to sender and file is downloading status to both sender and receiver and how much data is remaining. I don't know its possible or not just I thought.

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

@sandipchandra17 It can be possible. I can emit event when part of data has been transferred successfully.
But promises model is informing us about that. When promise is resolved -> data transferring is ended.

To be honest I saw the time difference between 'File received successfully' and 'File sent successfully:' ~300ms, when I transferred file ~10mb. I can not understand the cause of this delay, but I have several assumptions why it may happen. I see next:

  • async RN bridges;
  • network delays.

Apart of this I noticed, that sockets are closing after promise resolving. I think it's also incorrect and it may be a cause of damaged file. And I want to fix the socket closing. But I can not test my changes.
That's why I am asking you to help me with it.

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

Yes I will test it.. let me know once you are done.

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Discovered one problem. I'll try to fix it.

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

If possible please emit transfered byte and total bytes or in kb so that it can be shown in progressbar to sender and receiver using react native..

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Small update: my laptop has died😔
I'm going to send it to the service center within next few days (two days I hope).
Hope they can fix it quickly.

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

Oh sad.. wish it recover soon..

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

Hi Kirill,

Need one clarification:
Is this library support that sender can connect with multiple receiver and send same files to all receivers at the same time.
Or this feature not currently included?

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Need to test it :)

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

Another two questions and one observation:

  1. Is it possible to get own device name.
  2. Is it possible for receiver know the device name of which sender connected. Because from group info its not clear.
  3. Observation: when receiver successfully remove group but after long time later group info updated to sender means null.
    Is it normal as wifi direct taking time for this update or bug?

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024
  1. After enabling WiFI you should receive THIS_DEVICE_CHANGED_ACTION. According to this answer there should be info that you need.

For 2-3 I will have a look later, when my laptop will be repaired.

P. S. don't mix your issues into one place. Feel free to create different issues :)

from react-native-wifi-p2p.

sandipchandra17 avatar sandipchandra17 commented on August 30, 2024

Created 3 issues #34, #35 and #36

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

Hii
i am facing the same problem in my project. when i click on send message i will face this problem. please tell me what should i do? and one thing more i don't know how i test my code because i'm running my project on real device. it is connect with multiple wifi connections but message not send . just i used the code from github with no changes . can i need to change any part of my code so my message or file send successfully.
please help me.

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

@Rk-choudhary-ck The problem above was happening because sendMessage method was calling several times. Could you describe your steps more precisely? How many devices do you have? What is the error do you get? Which steps are you doing?

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

i am using the two android device my connection is established successfully but i am not share any message or file one to another device . could you tell me how should i start from first step.

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

Screenshot_2020-10-12-11-18-01-097_com sharedemo

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Hi @Rk-choudhary-ck
Did you follow this instruction?
Are you sure, that you completed 3d item in this list?

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

Hii Kirillzyusko
yes i following these instructions but i get a error about fail connection the error is :
Error while message sending [Error: failed to connect to /192.168.49.1 (port 8988) from /192.168.49.1 (port 38749) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused)]

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

[Error: failed to connect to /192.168.49.1 (port 8988) from /192.168.49.1 (port 38749) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused)]

@Rk-choudhary-ck When this error happens?
Could you send adb logcat logs as well?

P. S. it's worth to look at #26

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

i think it's no about logcat because it will happen in case when i send message .

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

I was asking for logs from logcat in order to understand where is the error happens...
Without logs from device I can not say anything, unfortunately.

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

Hii kirillzyusko
now i am face in log this kind of error.
LOG Error while file sending [Error: failed to connect to /192.168.49.1 (port 8988) from /192.168.49.1 (port 35053) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused)]

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

@Rk-choudhary-ck I can not help unless you provide adb logcat output. You give me only final exception. But I can not understand what is the reason of this exception. Maybe it's permission issues. Maybe something another. I don't know. That's why I ask you to give me logs from your device.

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

Thanks Kirillzyusko

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Hi @Rk-choudhary-ck
Can you please give an example of path that doesn't work?

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Hi @Rk-choudhary-ck
Please, have a look on this thread
Your path contains symbols like %3A. You should convert them to plain chars.

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

What is the path RNFS.DownloadDirectoryPath looks like?

Also why content://com.android.providers.media.documents/document/audio%3A34349 was converted to content://com.android.providers.media.documents/document/audio:3A34349? Shouldn't it be content://com.android.providers.media.documents/document/audio:34349?

And please @Rk-choudhary-ck - don't mix different issues. Feel free to create new one ;)

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

@Rk-choudhary-ck you missed a slash. It should be /storage/emulated/0/Download/.

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

@Rk-choudhary-ck if you want my help, then, please, attach adb logcat logs for both devices. For sender and for receiver.

And please, create new issue. Your problem doesn't seems to be correlated with described above.

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

@Rk-choudhary-ck well, first of all - you attached JS logs/logs from metro bundler. It's not sufficient information and I can not tell anything from this logs. Secondly - your problem is that you can not properly use two libraries together (react-native-document-picker and react-native-wifi-p2p) and it's not related to this issue (the problem in this issue is that sending multiple files with short delay is a cause of broken files).
So, PLEASE, create new issue and attach adb logs. Here is a brilliant article how to do it, but I'm pretty sure you can find a lot of other.
I will ignore any new posts here that are not related to the problem described in the first post of this thread.
Thanks in advance.

from react-native-wifi-p2p.

Rk-choudhary-ck avatar Rk-choudhary-ck commented on August 30, 2024

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

@Rk-choudhary-ck please, create a new issue.

from react-native-wifi-p2p.

ChandanBeraTechno avatar ChandanBeraTechno commented on August 30, 2024

Hii kirillzyusko,
now i am face in log this kind of error in react native.
Error: Error while message sending [Error: failed to connect to /192.168.49.1 (port 8988) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused)]

SYSTEM LOG:

LOG You can use the p2p mode
LOG startDiscoveringPeers status: success
LOG Running "BobakWifiDDemo" with {"rootTag":1}
LOG You can use the p2p mode
LOG startDiscoveringPeers status: success
LOG OnPeersUpdated [{"deviceAddress": "e6:46:da:85:bc:eb", "deviceName": "Redmi note 4", "isGroupOwner": false, "primaryDeviceType": "10-0050F204-5", "secondaryDeviceType": null, "status": 3}, {"deviceAddress": "0c:54:15:e6:39:6d", "deviceName": "INDLAPTOP333", "isGroupOwner": true, "primaryDeviceType": "7-0050F200-0", "secondaryDeviceType": null, "status": 3}]
LOG OnPeersUpdated [{"deviceAddress": "0c:54:15:e6:39:6d", "deviceName": "INDLAPTOP333", "isGroupOwner": true, "primaryDeviceType": "7-0050F200-0", "secondaryDeviceType": null, "status": 3}, {"deviceAddress": "ae:c1:ee:63:51:69", "deviceName": "Redmi note 3", "isGroupOwner": true, "primaryDeviceType": "10-0050F204-5", "secondaryDeviceType": null, "status": 3}]
LOG OnPeersUpdated [{"deviceAddress": "0c:54:15:e6:39:6d", "deviceName": "INDLAPTOP333", "isGroupOwner": true, "primaryDeviceType": "7-0050F200-0", "secondaryDeviceType": null, "status": 3}, {"deviceAddress": "ae:c1:ee:63:51:69", "deviceName": "Redmi note 3", "isGroupOwner": true, "primaryDeviceType": "10-0050F204-5", "secondaryDeviceType": null, "status": 3}]
LOG Group created successfully!
LOG THIS_DEVICE_CHANGED_ACTION {"interface": "p2p0", "networkName": "DIRECT-Ht-Android_abfa", "owner": {"deviceAddress": "e6:46:da:85:bc:eb", "deviceName": "", "primaryDeviceType": null, "secondaryDeviceType": null, "status": 4}, "passphrase": "6eu23hhL"}
LOG OnConnectionInfoUpdated {"groupFormed": true, "groupOwnerAddress": {"hostAddress": "192.168.49.1", "isLoopbackAddress": false}, "isGroupOwner": true}
LOG OnPeersUpdated [{"deviceAddress": "e6:46:da:85:bc:eb", "deviceName": "Redmi note 4", "isGroupOwner": true, "primaryDeviceType": "10-0050F204-5", "secondaryDeviceType": null, "status": 3}, {"deviceAddress": "0c:54:15:e6:39:6d", "deviceName": "INDLAPTOP333", "isGroupOwner": true, "primaryDeviceType": "7-0050F200-0", "secondaryDeviceType": null, "status": 3}]
LOG Connect to: {"deviceAddress": "e6:46:da:85:bc:eb", "deviceName": "Redmi note 4", "isGroupOwner": true, "primaryDeviceType": "10-0050F204-5", "secondaryDeviceType": null, "status": 3}
LOG Successfully connected
LOG OnPeersUpdated [{"deviceAddress": "e6:46:da:85:bc:eb", "deviceName": "Redmi note 4", "isGroupOwner": true, "primaryDeviceType": "10-0050F204-5", "secondaryDeviceType": null, "status": 1}, {"deviceAddress": "0c:54:15:e6:39:6d", "deviceName": "INDLAPTOP333", "isGroupOwner": true, "primaryDeviceType": "7-0050F200-0", "secondaryDeviceType": null, "status": 3}]
LOG OnPeersUpdated [{"deviceAddress": "e6:46:da:85:bc:eb", "deviceName": "Redmi note 4", "isGroupOwner": true, "primaryDeviceType": "10-0050F204-5", "secondaryDeviceType": null, "status": 0}, {"deviceAddress": "0c:54:15:e6:39:6d", "deviceName": "INDLAPTOP333", "isGroupOwner": true, "primaryDeviceType": "7-0050F200-0", "secondaryDeviceType": null, "status": 3}]
LOG OnConnectionInfoUpdated {"groupFormed": true, "groupOwnerAddress": {"hostAddress": "192.168.49.1", "isLoopbackAddress": false}, "isGroupOwner": true}
LOG getConnectionInfo {"groupFormed": true, "groupOwnerAddress": {"hostAddress": "192.168.49.1", "isLoopbackAddress": false}, "isGroupOwner": true}
LOG OnPeersUpdated []
LOG OnPeersUpdated []
LOG Error while message sending [Error: failed to connect to /192.168.49.1 (port 8988) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused)]
LOG OnPeersUpdated [{"deviceAddress": "e6:46:da:85:bc:eb", "deviceName": "Redmi note 4", "isGroupOwner": true, "primaryDeviceType": "10-0050F204-5", "secondaryDeviceType": null, "status": 0}]

from react-native-wifi-p2p.

kirillzyusko avatar kirillzyusko commented on August 30, 2024

Seems like you can not establish a connection within 5s.
Why OnPeersUpdated reports empty array in the end?

from react-native-wifi-p2p.

Related Issues (20)

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.