Re: [codenameone-discussions] Re: Net Communications on iphone device

2021-03-20 Thread Dennis Rogers
Many thanks to you guys for all the help. Using the POST method seems to 
have solved the problem. -Dennis

On Friday, March 19, 2021 at 12:35:35 PM UTC-4 Steve Hannah wrote:

> Have you tried setting the request method to POST?
>
> URL url = new URL("https://symdesigns.com/php/export.php;);
>
> URL.HttpURLConnection link = (URL.HttpURLConnection)url.openConnection();
> link.setRequestMethod("POST");
>
> ...
>
>
>
> On Fri, Mar 19, 2021 at 9:14 AM Dennis Rogers  wrote:
>
>> I don't know if this helps but here's the php server code that reads the 
>> credentials
>>
>> $std = fopen("php://input","r");
>> if($std==false) logError("Can't open input");
>> $ln1 = fgets($std);
>> $reply = sscanf(str_replace(" ","",$ln1),"%s");
>> $email = trim($reply[0],"\n");
>> logError(sprintf("line 1 = %s, email = %s",$ln1,$email));
>> $ln2 = fgets($std);
>> $reply = sscanf(str_replace(" ","",$ln2),"%s");
>> $passwd = trim($reply[0],"\n");
>> logError(sprintf("line 2 = %s, passwd = %s",$ln2,$passwd));
>>
>> When running on the iphone the strings $ln1,$email, $ln2, and $passwd are 
>> blank. I 'm able to view the output from the logError function.
>> -Dennis
>>
>> On Friday, March 19, 2021 at 12:06:02 PM UTC-4 Dennis Rogers wrote:
>>
>>> Thanks for trying the test code. "Success" is just the name of the 
>>> dialog. "nok" means that the credentials were not correct. Actually, from 
>>> the server logs, it appears to have received a blank email and password.
>>>
>>> On Thursday, March 18, 2021 at 4:02:12 PM UTC-4 Steve Hannah wrote:
>>>
 I just tried building the test:

 Form hi = new Form("Hi World", BoxLayout.y());
 Button test = new Button("Test");
 hi.add(test);
 test.addActionListener(e -> {
 try {

 URL url = new URL("https://symdesigns.com/php/export.php;);


 URL.URLConnection link = url.openConnection();
 link.setDoOutput(true);
 link.setDoInput(true);
 OutputStream os = link.getOutputStream();
 os.write(("te...@x.com\n").getBytes());
 os.write(("f47ba92cf7\n").getBytes());
 os.close();

 InputStream is = link.getInputStream();
 String ans = Util.readToString(is);

 Dialog.show("Success", ans, "OK", null);
 } catch(Exception err) {
 Dialog.show("Error", err.toString(), "OK", null);
 Log.p("URL error");
 Log.e(err);
 }
 });

 hi.show();


 Codename One Simulator:  Passed
 Xcode Simulator (running iPhone 6 - iOS 12.1) : Passed
 iPhone 5 - iOS 10.3.3 (actual device) : Passed


 By "Passed", I mean I get a dialog that says "Success" in the title and 
 "Nok" in the body.




 On Thu, Mar 18, 2021 at 11:44 AM Dennis Rogers  
 wrote:

>
> The server received empty strings for the email and the password from 
> the iphone device (but it received the correct strings from the simulator 
> and the android device). This is very frustrating!
>
> I'm not sure what you mean by "chunked requests". Do you mean requests 
> that have been gziped?
> On Wednesday, March 17, 2021 at 11:05:55 PM UTC-4 Shai Almog wrote:
>
>> I was able to run it and got a NOK from the server. The question is 
>> what did the server get?
>> Can your server deal with chunked requests?
>> gzip?
>>
>> On Wednesday, March 17, 2021 at 7:28:48 AM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> No problem!
>>>
>>>
>>> On Tuesday, March 16, 2021 at 11:03:16 PM UTC-4 Shai Almog wrote:
>>>
 I'll look into it. It works in the simulator but I have a couple of 
 issues with my environment so it will take me. a couple of days to 
 reproduce it on a device.

 On Tuesday, March 16, 2021 at 11:37:29 PM UTC+2 a2nd...@gmail.com 
 wrote:

>
> BTW, It seems to work ok on the android device.
> On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:
>
>> The URL is wrong. It should be: "
>> https://symdesigns.com/php/export.php;. 
>> With that change your test code seems to work ok on the simulator 
>> (returns ok) but
>> on the device it doesn't (returns nok); When I look at the server 
>> logs it still seems to receive 
>> a blank email and password when run from the device.
>> On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:
>>
>>> I ran this test case but I'm getting an error from the server in 
>>> the "success" dialog:
>>>
>>> Form hi = new Form("Hi World", BoxLayout.y());
>>> Button test = new Button("Test");
>>> hi.add(test);
>>> test.addActionListener(e -> {
>>>try {
>>>  URL url = new URL("
>>> 

Re: [codenameone-discussions] Re: Net Communications on iphone device

2021-03-19 Thread Steve Hannah
Have you tried setting the request method to POST?

URL url = new URL("https://symdesigns.com/php/export.php;);
URL.HttpURLConnection link = (URL.HttpURLConnection)url.openConnection();
link.setRequestMethod("POST");

...



On Fri, Mar 19, 2021 at 9:14 AM Dennis Rogers  wrote:

> I don't know if this helps but here's the php server code that reads the
> credentials
>
> $std = fopen("php://input","r");
> if($std==false) logError("Can't open input");
> $ln1 = fgets($std);
> $reply = sscanf(str_replace(" ","",$ln1),"%s");
> $email = trim($reply[0],"\n");
> logError(sprintf("line 1 = %s, email = %s",$ln1,$email));
> $ln2 = fgets($std);
> $reply = sscanf(str_replace(" ","",$ln2),"%s");
> $passwd = trim($reply[0],"\n");
> logError(sprintf("line 2 = %s, passwd = %s",$ln2,$passwd));
>
> When running on the iphone the strings $ln1,$email, $ln2, and $passwd are
> blank. I 'm able to view the output from the logError function.
> -Dennis
>
> On Friday, March 19, 2021 at 12:06:02 PM UTC-4 Dennis Rogers wrote:
>
>> Thanks for trying the test code. "Success" is just the name of the
>> dialog. "nok" means that the credentials were not correct. Actually, from
>> the server logs, it appears to have received a blank email and password.
>>
>> On Thursday, March 18, 2021 at 4:02:12 PM UTC-4 Steve Hannah wrote:
>>
>>> I just tried building the test:
>>>
>>> Form hi = new Form("Hi World", BoxLayout.y());
>>> Button test = new Button("Test");
>>> hi.add(test);
>>> test.addActionListener(e -> {
>>> try {
>>>
>>> URL url = new URL("https://symdesigns.com/php/export.php;);
>>>
>>>
>>> URL.URLConnection link = url.openConnection();
>>> link.setDoOutput(true);
>>> link.setDoInput(true);
>>> OutputStream os = link.getOutputStream();
>>> os.write(("te...@x.com\n").getBytes());
>>> os.write(("f47ba92cf7\n").getBytes());
>>> os.close();
>>>
>>> InputStream is = link.getInputStream();
>>> String ans = Util.readToString(is);
>>>
>>> Dialog.show("Success", ans, "OK", null);
>>> } catch(Exception err) {
>>> Dialog.show("Error", err.toString(), "OK", null);
>>> Log.p("URL error");
>>> Log.e(err);
>>> }
>>> });
>>>
>>> hi.show();
>>>
>>>
>>> Codename One Simulator:  Passed
>>> Xcode Simulator (running iPhone 6 - iOS 12.1) : Passed
>>> iPhone 5 - iOS 10.3.3 (actual device) : Passed
>>>
>>>
>>> By "Passed", I mean I get a dialog that says "Success" in the title and 
>>> "Nok" in the body.
>>>
>>>
>>>
>>>
>>> On Thu, Mar 18, 2021 at 11:44 AM Dennis Rogers 
>>> wrote:
>>>

 The server received empty strings for the email and the password from
 the iphone device (but it received the correct strings from the simulator
 and the android device). This is very frustrating!

 I'm not sure what you mean by "chunked requests". Do you mean requests
 that have been gziped?
 On Wednesday, March 17, 2021 at 11:05:55 PM UTC-4 Shai Almog wrote:

> I was able to run it and got a NOK from the server. The question is
> what did the server get?
> Can your server deal with chunked requests?
> gzip?
>
> On Wednesday, March 17, 2021 at 7:28:48 AM UTC+2 a2nd...@gmail.com
> wrote:
>
>> No problem!
>>
>>
>> On Tuesday, March 16, 2021 at 11:03:16 PM UTC-4 Shai Almog wrote:
>>
>>> I'll look into it. It works in the simulator but I have a couple of
>>> issues with my environment so it will take me. a couple of days to
>>> reproduce it on a device.
>>>
>>> On Tuesday, March 16, 2021 at 11:37:29 PM UTC+2 a2nd...@gmail.com
>>> wrote:
>>>

 BTW, It seems to work ok on the android device.
 On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:

> The URL is wrong. It should be: "
> https://symdesigns.com/php/export.php;.
> With that change your test code seems to work ok on the simulator
> (returns ok) but
> on the device it doesn't (returns nok); When I look at the server
> logs it still seems to receive
> a blank email and password when run from the device.
> On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:
>
>> I ran this test case but I'm getting an error from the server in
>> the "success" dialog:
>>
>> Form hi = new Form("Hi World", BoxLayout.y());
>> Button test = new Button("Test");
>> hi.add(test);
>> test.addActionListener(e -> {
>>try {
>>  URL url = new URL("
>> https://symdesigns.com/symdesigns.com/php/export.php;);
>>  URL.URLConnection link = url.openConnection();
>>  link.setDoOutput(true);
>>  link.setDoInput(true);
>>  OutputStream os = link.getOutputStream();
>>  os.write(("te...@x.com\n").getBytes());
>>  

Re: [codenameone-discussions] Re: Net Communications on iphone device

2021-03-19 Thread Dennis Rogers
I don't know if this helps but here's the php server code that reads the 
credentials

$std = fopen("php://input","r");
if($std==false) logError("Can't open input");
$ln1 = fgets($std);
$reply = sscanf(str_replace(" ","",$ln1),"%s");
$email = trim($reply[0],"\n");
logError(sprintf("line 1 = %s, email = %s",$ln1,$email));
$ln2 = fgets($std);
$reply = sscanf(str_replace(" ","",$ln2),"%s");
$passwd = trim($reply[0],"\n");
logError(sprintf("line 2 = %s, passwd = %s",$ln2,$passwd));

When running on the iphone the strings $ln1,$email, $ln2, and $passwd are 
blank. I 'm able to view the output from the logError function.
-Dennis

On Friday, March 19, 2021 at 12:06:02 PM UTC-4 Dennis Rogers wrote:

> Thanks for trying the test code. "Success" is just the name of the dialog. 
> "nok" means that the credentials were not correct. Actually, from the 
> server logs, it appears to have received a blank email and password.
>
> On Thursday, March 18, 2021 at 4:02:12 PM UTC-4 Steve Hannah wrote:
>
>> I just tried building the test:
>>
>> Form hi = new Form("Hi World", BoxLayout.y());
>> Button test = new Button("Test");
>> hi.add(test);
>> test.addActionListener(e -> {
>> try {
>>
>> URL url = new URL("https://symdesigns.com/php/export.php;);
>>
>>
>> URL.URLConnection link = url.openConnection();
>> link.setDoOutput(true);
>> link.setDoInput(true);
>> OutputStream os = link.getOutputStream();
>> os.write(("te...@x.com\n").getBytes());
>> os.write(("f47ba92cf7\n").getBytes());
>> os.close();
>>
>> InputStream is = link.getInputStream();
>> String ans = Util.readToString(is);
>>
>> Dialog.show("Success", ans, "OK", null);
>> } catch(Exception err) {
>> Dialog.show("Error", err.toString(), "OK", null);
>> Log.p("URL error");
>> Log.e(err);
>> }
>> });
>>
>> hi.show();
>>
>>
>> Codename One Simulator:  Passed
>> Xcode Simulator (running iPhone 6 - iOS 12.1) : Passed
>> iPhone 5 - iOS 10.3.3 (actual device) : Passed
>>
>>
>> By "Passed", I mean I get a dialog that says "Success" in the title and 
>> "Nok" in the body.
>>
>>
>>
>>
>> On Thu, Mar 18, 2021 at 11:44 AM Dennis Rogers  wrote:
>>
>>>
>>> The server received empty strings for the email and the password from 
>>> the iphone device (but it received the correct strings from the simulator 
>>> and the android device). This is very frustrating!
>>>
>>> I'm not sure what you mean by "chunked requests". Do you mean requests 
>>> that have been gziped?
>>> On Wednesday, March 17, 2021 at 11:05:55 PM UTC-4 Shai Almog wrote:
>>>
 I was able to run it and got a NOK from the server. The question is 
 what did the server get?
 Can your server deal with chunked requests?
 gzip?

 On Wednesday, March 17, 2021 at 7:28:48 AM UTC+2 a2nd...@gmail.com 
 wrote:

> No problem!
>
>
> On Tuesday, March 16, 2021 at 11:03:16 PM UTC-4 Shai Almog wrote:
>
>> I'll look into it. It works in the simulator but I have a couple of 
>> issues with my environment so it will take me. a couple of days to 
>> reproduce it on a device.
>>
>> On Tuesday, March 16, 2021 at 11:37:29 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>>
>>> BTW, It seems to work ok on the android device.
>>> On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:
>>>
 The URL is wrong. It should be: "
 https://symdesigns.com/php/export.php;. 
 With that change your test code seems to work ok on the simulator 
 (returns ok) but
 on the device it doesn't (returns nok); When I look at the server 
 logs it still seems to receive 
 a blank email and password when run from the device.
 On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:

> I ran this test case but I'm getting an error from the server in 
> the "success" dialog:
>
> Form hi = new Form("Hi World", BoxLayout.y());
> Button test = new Button("Test");
> hi.add(test);
> test.addActionListener(e -> {
>try {
>  URL url = new URL("
> https://symdesigns.com/symdesigns.com/php/export.php;);
>  URL.URLConnection link = url.openConnection();
>  link.setDoOutput(true);
>  link.setDoInput(true);
>  OutputStream os = link.getOutputStream();
>  os.write(("te...@x.com\n").getBytes());
>  os.write(("f47ba92cf7\n").getBytes());
>  os.close();
>
>  InputStream is = link.getInputStream();
>  String ans = Util.readToString(is);
>
>  Dialog.show("Success", ans, "OK", null);
>} catch(Exception err) {
>  Dialog.show("Error", err.toString(), "OK", null);
>  Log.p("URL error");
>  Log.e(err);
>}
> });

Re: [codenameone-discussions] Re: Net Communications on iphone device

2021-03-19 Thread Dennis Rogers
Thanks for trying the test code. "Success" is just the name of the dialog. 
"nok" means that the credentials were not correct. Actually, from the 
server logs, it appears to have received a blank email and password.

On Thursday, March 18, 2021 at 4:02:12 PM UTC-4 Steve Hannah wrote:

> I just tried building the test:
>
> Form hi = new Form("Hi World", BoxLayout.y());
> Button test = new Button("Test");
> hi.add(test);
> test.addActionListener(e -> {
> try {
>
> URL url = new URL("https://symdesigns.com/php/export.php;);
>
>
> URL.URLConnection link = url.openConnection();
> link.setDoOutput(true);
> link.setDoInput(true);
> OutputStream os = link.getOutputStream();
> os.write(("te...@x.com\n").getBytes());
> os.write(("f47ba92cf7\n").getBytes());
> os.close();
>
> InputStream is = link.getInputStream();
> String ans = Util.readToString(is);
>
> Dialog.show("Success", ans, "OK", null);
> } catch(Exception err) {
> Dialog.show("Error", err.toString(), "OK", null);
> Log.p("URL error");
> Log.e(err);
> }
> });
>
> hi.show();
>
>
> Codename One Simulator:  Passed
> Xcode Simulator (running iPhone 6 - iOS 12.1) : Passed
> iPhone 5 - iOS 10.3.3 (actual device) : Passed
>
>
> By "Passed", I mean I get a dialog that says "Success" in the title and "Nok" 
> in the body.
>
>
>
>
> On Thu, Mar 18, 2021 at 11:44 AM Dennis Rogers  wrote:
>
>>
>> The server received empty strings for the email and the password from the 
>> iphone device (but it received the correct strings from the simulator and 
>> the android device). This is very frustrating!
>>
>> I'm not sure what you mean by "chunked requests". Do you mean requests 
>> that have been gziped?
>> On Wednesday, March 17, 2021 at 11:05:55 PM UTC-4 Shai Almog wrote:
>>
>>> I was able to run it and got a NOK from the server. The question is what 
>>> did the server get?
>>> Can your server deal with chunked requests?
>>> gzip?
>>>
>>> On Wednesday, March 17, 2021 at 7:28:48 AM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 No problem!


 On Tuesday, March 16, 2021 at 11:03:16 PM UTC-4 Shai Almog wrote:

> I'll look into it. It works in the simulator but I have a couple of 
> issues with my environment so it will take me. a couple of days to 
> reproduce it on a device.
>
> On Tuesday, March 16, 2021 at 11:37:29 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>>
>> BTW, It seems to work ok on the android device.
>> On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:
>>
>>> The URL is wrong. It should be: "
>>> https://symdesigns.com/php/export.php;. 
>>> With that change your test code seems to work ok on the simulator 
>>> (returns ok) but
>>> on the device it doesn't (returns nok); When I look at the server 
>>> logs it still seems to receive 
>>> a blank email and password when run from the device.
>>> On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:
>>>
 I ran this test case but I'm getting an error from the server in 
 the "success" dialog:

 Form hi = new Form("Hi World", BoxLayout.y());
 Button test = new Button("Test");
 hi.add(test);
 test.addActionListener(e -> {
try {
  URL url = new URL("
 https://symdesigns.com/symdesigns.com/php/export.php;);
  URL.URLConnection link = url.openConnection();
  link.setDoOutput(true);
  link.setDoInput(true);
  OutputStream os = link.getOutputStream();
  os.write(("te...@x.com\n").getBytes());
  os.write(("f47ba92cf7\n").getBytes());
  os.close();

  InputStream is = link.getInputStream();
  String ans = Util.readToString(is);

  Dialog.show("Success", ans, "OK", null);
} catch(Exception err) {
  Dialog.show("Error", err.toString(), "OK", null);
  Log.p("URL error");
  Log.e(err);
}
 });

 hi.show();

 On Monday, March 15, 2021 at 4:04:23 PM UTC+2 a2nd...@gmail.com 
 wrote:

> "f47ba92cf7" is the hashed password i.e.
>
> "f47ba92cf7" = getHash("test2.xcom"+"pw2")
>
> The following is the getHash code I'm using:
>
> static String getHash(String str) {
> return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
> }
> public static String dumpBytes(byte[] buffer) {
> if (buffer == null) {
> return "";
> }
> StringBuilder sb = new StringBuilder();
> sb.setLength(0);
> for (int i = 0; i < buffer.length; i++) {
> sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
> .append((char) (HEX_CHAR[buffer[i] & 

Re: [codenameone-discussions] Re: Net Communications on iphone device

2021-03-18 Thread Steve Hannah
I just tried building the test:

Form hi = new Form("Hi World", BoxLayout.y());
Button test = new Button("Test");
hi.add(test);
test.addActionListener(e -> {
try {
URL url = new URL("https://symdesigns.com/php/export.php;);
URL.URLConnection link = url.openConnection();
link.setDoOutput(true);
link.setDoInput(true);
OutputStream os = link.getOutputStream();
os.write(("te...@x.com\n").getBytes());
os.write(("f47ba92cf7\n").getBytes());
os.close();

InputStream is = link.getInputStream();
String ans = Util.readToString(is);

Dialog.show("Success", ans, "OK", null);
} catch(Exception err) {
Dialog.show("Error", err.toString(), "OK", null);
Log.p("URL error");
Log.e(err);
}
});

hi.show();


Codename One Simulator:  Passed
Xcode Simulator (running iPhone 6 - iOS 12.1) : Passed
iPhone 5 - iOS 10.3.3 (actual device) : Passed


By "Passed", I mean I get a dialog that says "Success" in the title
and "Nok" in the body.




On Thu, Mar 18, 2021 at 11:44 AM Dennis Rogers  wrote:

>
> The server received empty strings for the email and the password from the
> iphone device (but it received the correct strings from the simulator and
> the android device). This is very frustrating!
>
> I'm not sure what you mean by "chunked requests". Do you mean requests
> that have been gziped?
> On Wednesday, March 17, 2021 at 11:05:55 PM UTC-4 Shai Almog wrote:
>
>> I was able to run it and got a NOK from the server. The question is what
>> did the server get?
>> Can your server deal with chunked requests?
>> gzip?
>>
>> On Wednesday, March 17, 2021 at 7:28:48 AM UTC+2 a2nd...@gmail.com wrote:
>>
>>> No problem!
>>>
>>>
>>> On Tuesday, March 16, 2021 at 11:03:16 PM UTC-4 Shai Almog wrote:
>>>
 I'll look into it. It works in the simulator but I have a couple of
 issues with my environment so it will take me. a couple of days to
 reproduce it on a device.

 On Tuesday, March 16, 2021 at 11:37:29 PM UTC+2 a2nd...@gmail.com
 wrote:

>
> BTW, It seems to work ok on the android device.
> On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:
>
>> The URL is wrong. It should be: "
>> https://symdesigns.com/php/export.php;.
>> With that change your test code seems to work ok on the simulator
>> (returns ok) but
>> on the device it doesn't (returns nok); When I look at the server
>> logs it still seems to receive
>> a blank email and password when run from the device.
>> On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:
>>
>>> I ran this test case but I'm getting an error from the server in the
>>> "success" dialog:
>>>
>>> Form hi = new Form("Hi World", BoxLayout.y());
>>> Button test = new Button("Test");
>>> hi.add(test);
>>> test.addActionListener(e -> {
>>>try {
>>>  URL url = new URL("
>>> https://symdesigns.com/symdesigns.com/php/export.php;);
>>>  URL.URLConnection link = url.openConnection();
>>>  link.setDoOutput(true);
>>>  link.setDoInput(true);
>>>  OutputStream os = link.getOutputStream();
>>>  os.write(("te...@x.com\n").getBytes());
>>>  os.write(("f47ba92cf7\n").getBytes());
>>>  os.close();
>>>
>>>  InputStream is = link.getInputStream();
>>>  String ans = Util.readToString(is);
>>>
>>>  Dialog.show("Success", ans, "OK", null);
>>>} catch(Exception err) {
>>>  Dialog.show("Error", err.toString(), "OK", null);
>>>  Log.p("URL error");
>>>  Log.e(err);
>>>}
>>> });
>>>
>>> hi.show();
>>>
>>> On Monday, March 15, 2021 at 4:04:23 PM UTC+2 a2nd...@gmail.com
>>> wrote:
>>>
 "f47ba92cf7" is the hashed password i.e.

 "f47ba92cf7" = getHash("test2.xcom"+"pw2")

 The following is the getHash code I'm using:

 static String getHash(String str) {
 return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
 }
 public static String dumpBytes(byte[] buffer) {
 if (buffer == null) {
 return "";
 }
 StringBuilder sb = new StringBuilder();
 sb.setLength(0);
 for (int i = 0; i < buffer.length; i++) {
 sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
 .append((char) (HEX_CHAR[buffer[i] & 0x000F]));
 }
 return sb.toString();
 }

 BTW What time zone are you in?

 -Dennis
 On Sunday, March 14, 2021 at 10:08:01 PM UTC-4 Shai Almog wrote:

> Thanks!
> I'm trying to reproduce it and noticed I'm still missing the code
> of getHash.
>
> On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com
> wrote:
>
>> I forgot to tell you. 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-18 Thread Dennis Rogers

The server received empty strings for the email and the password from the 
iphone device (but it received the correct strings from the simulator and 
the android device). This is very frustrating!

I'm not sure what you mean by "chunked requests". Do you mean requests that 
have been gziped?
On Wednesday, March 17, 2021 at 11:05:55 PM UTC-4 Shai Almog wrote:

> I was able to run it and got a NOK from the server. The question is what 
> did the server get?
> Can your server deal with chunked requests?
> gzip?
>
> On Wednesday, March 17, 2021 at 7:28:48 AM UTC+2 a2nd...@gmail.com wrote:
>
>> No problem!
>>
>>
>> On Tuesday, March 16, 2021 at 11:03:16 PM UTC-4 Shai Almog wrote:
>>
>>> I'll look into it. It works in the simulator but I have a couple of 
>>> issues with my environment so it will take me. a couple of days to 
>>> reproduce it on a device.
>>>
>>> On Tuesday, March 16, 2021 at 11:37:29 PM UTC+2 a2nd...@gmail.com wrote:
>>>

 BTW, It seems to work ok on the android device.
 On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:

> The URL is wrong. It should be: "https://symdesigns.com/php/export.php
> ". 
> With that change your test code seems to work ok on the simulator 
> (returns ok) but
> on the device it doesn't (returns nok); When I look at the server logs 
> it still seems to receive 
> a blank email and password when run from the device.
> On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:
>
>> I ran this test case but I'm getting an error from the server in the 
>> "success" dialog:
>>
>> Form hi = new Form("Hi World", BoxLayout.y());
>> Button test = new Button("Test");
>> hi.add(test);
>> test.addActionListener(e -> {
>>try {
>>  URL url = new URL("
>> https://symdesigns.com/symdesigns.com/php/export.php;);
>>  URL.URLConnection link = url.openConnection();
>>  link.setDoOutput(true);
>>  link.setDoInput(true);
>>  OutputStream os = link.getOutputStream();
>>  os.write(("te...@x.com\n").getBytes());
>>  os.write(("f47ba92cf7\n").getBytes());
>>  os.close();
>>
>>  InputStream is = link.getInputStream();
>>  String ans = Util.readToString(is);
>>
>>  Dialog.show("Success", ans, "OK", null);
>>} catch(Exception err) {
>>  Dialog.show("Error", err.toString(), "OK", null);
>>  Log.p("URL error");
>>  Log.e(err);
>>}
>> });
>>
>> hi.show();
>>
>> On Monday, March 15, 2021 at 4:04:23 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> "f47ba92cf7" is the hashed password i.e.
>>>
>>> "f47ba92cf7" = getHash("test2.xcom"+"pw2")
>>>
>>> The following is the getHash code I'm using:
>>>
>>> static String getHash(String str) {
>>> return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
>>> }
>>> public static String dumpBytes(byte[] buffer) {
>>> if (buffer == null) {
>>> return "";
>>> }
>>> StringBuilder sb = new StringBuilder();
>>> sb.setLength(0);
>>> for (int i = 0; i < buffer.length; i++) {
>>> sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
>>> .append((char) (HEX_CHAR[buffer[i] & 0x000F]));
>>> }
>>> return sb.toString();
>>> }
>>>
>>> BTW What time zone are you in?
>>>
>>> -Dennis
>>> On Sunday, March 14, 2021 at 10:08:01 PM UTC-4 Shai Almog wrote:
>>>
 Thanks!
 I'm trying to reproduce it and noticed I'm still missing the code 
 of getHash.

 On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com 
 wrote:

> I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".
>
> On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:
>
>> Sure, You can use "te...@x.com" for the email (user id) and 
>> "pw2" as the password.
>
>
>>
>> On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:
>>
>>> Thanks, is it possible to create a dummy username/password combo 
>>> with no permissions so we can test this?
>>>
>>> On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 
>>> a2nd...@gmail.com wrote:
>>>
 The server URL is https://www.symdesigns.com. I have a web 
 page at symdesigns.com/ShoppingGenie/index.html and the server 
 php is /symdesigns.com/php/export.php .

 On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:

> Interesting, can you expose the server URL so we can run this 
> test case and see?
>
> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 
> a2nd...@gmail.com wrote:
>
>> I switched to using 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-17 Thread Shai Almog
I was able to run it and got a NOK from the server. The question is what 
did the server get?
Can your server deal with chunked requests?
gzip?

On Wednesday, March 17, 2021 at 7:28:48 AM UTC+2 a2nd...@gmail.com wrote:

> No problem!
>
>
> On Tuesday, March 16, 2021 at 11:03:16 PM UTC-4 Shai Almog wrote:
>
>> I'll look into it. It works in the simulator but I have a couple of 
>> issues with my environment so it will take me. a couple of days to 
>> reproduce it on a device.
>>
>> On Tuesday, March 16, 2021 at 11:37:29 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>>
>>> BTW, It seems to work ok on the android device.
>>> On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:
>>>
 The URL is wrong. It should be: "https://symdesigns.com/php/export.php
 ". 
 With that change your test code seems to work ok on the simulator 
 (returns ok) but
 on the device it doesn't (returns nok); When I look at the server logs 
 it still seems to receive 
 a blank email and password when run from the device.
 On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:

> I ran this test case but I'm getting an error from the server in the 
> "success" dialog:
>
> Form hi = new Form("Hi World", BoxLayout.y());
> Button test = new Button("Test");
> hi.add(test);
> test.addActionListener(e -> {
>try {
>  URL url = new URL("
> https://symdesigns.com/symdesigns.com/php/export.php;);
>  URL.URLConnection link = url.openConnection();
>  link.setDoOutput(true);
>  link.setDoInput(true);
>  OutputStream os = link.getOutputStream();
>  os.write(("te...@x.com\n").getBytes());
>  os.write(("f47ba92cf7\n").getBytes());
>  os.close();
>
>  InputStream is = link.getInputStream();
>  String ans = Util.readToString(is);
>
>  Dialog.show("Success", ans, "OK", null);
>} catch(Exception err) {
>  Dialog.show("Error", err.toString(), "OK", null);
>  Log.p("URL error");
>  Log.e(err);
>}
> });
>
> hi.show();
>
> On Monday, March 15, 2021 at 4:04:23 PM UTC+2 a2nd...@gmail.com wrote:
>
>> "f47ba92cf7" is the hashed password i.e.
>>
>> "f47ba92cf7" = getHash("test2.xcom"+"pw2")
>>
>> The following is the getHash code I'm using:
>>
>> static String getHash(String str) {
>> return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
>> }
>> public static String dumpBytes(byte[] buffer) {
>> if (buffer == null) {
>> return "";
>> }
>> StringBuilder sb = new StringBuilder();
>> sb.setLength(0);
>> for (int i = 0; i < buffer.length; i++) {
>> sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
>> .append((char) (HEX_CHAR[buffer[i] & 0x000F]));
>> }
>> return sb.toString();
>> }
>>
>> BTW What time zone are you in?
>>
>> -Dennis
>> On Sunday, March 14, 2021 at 10:08:01 PM UTC-4 Shai Almog wrote:
>>
>>> Thanks!
>>> I'm trying to reproduce it and noticed I'm still missing the code of 
>>> getHash.
>>>
>>> On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".

 On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:

> Sure, You can use "te...@x.com" for the email (user id) and "pw2" 
> as the password.


>
> On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:
>
>> Thanks, is it possible to create a dummy username/password combo 
>> with no permissions so we can test this?
>>
>> On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> The server URL is https://www.symdesigns.com. I have a web page 
>>> at symdesigns.com/ShoppingGenie/index.html and the server php 
>>> is /symdesigns.com/php/export.php .
>>>
>>> On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:
>>>
 Interesting, can you expose the server URL so we can run this 
 test case and see?

 On Friday, March 12, 2021 at 10:57:24 PM UTC+2 
 a2nd...@gmail.com wrote:

> I switched to using Util.readToString() and still no joy on 
> the iphone device.
> The code still works ok on the simulator and on also on a real 
> Android device.
>
> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog 
> wrote:
>
>> Try using String ans = Util.readToString(); which might be 
>> better. 
>> Is the code still working on the simulator after the changes?
>> Is it working 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-16 Thread Dennis Rogers
No problem!


On Tuesday, March 16, 2021 at 11:03:16 PM UTC-4 Shai Almog wrote:

> I'll look into it. It works in the simulator but I have a couple of issues 
> with my environment so it will take me. a couple of days to reproduce it on 
> a device.
>
> On Tuesday, March 16, 2021 at 11:37:29 PM UTC+2 a2nd...@gmail.com wrote:
>
>>
>> BTW, It seems to work ok on the android device.
>> On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:
>>
>>> The URL is wrong. It should be: "https://symdesigns.com/php/export.php
>>> ". 
>>> With that change your test code seems to work ok on the simulator 
>>> (returns ok) but
>>> on the device it doesn't (returns nok); When I look at the server logs 
>>> it still seems to receive 
>>> a blank email and password when run from the device.
>>> On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:
>>>
 I ran this test case but I'm getting an error from the server in the 
 "success" dialog:

 Form hi = new Form("Hi World", BoxLayout.y());
 Button test = new Button("Test");
 hi.add(test);
 test.addActionListener(e -> {
try {
  URL url = new URL("
 https://symdesigns.com/symdesigns.com/php/export.php;);
  URL.URLConnection link = url.openConnection();
  link.setDoOutput(true);
  link.setDoInput(true);
  OutputStream os = link.getOutputStream();
  os.write(("te...@x.com\n").getBytes());
  os.write(("f47ba92cf7\n").getBytes());
  os.close();

  InputStream is = link.getInputStream();
  String ans = Util.readToString(is);

  Dialog.show("Success", ans, "OK", null);
} catch(Exception err) {
  Dialog.show("Error", err.toString(), "OK", null);
  Log.p("URL error");
  Log.e(err);
}
 });

 hi.show();

 On Monday, March 15, 2021 at 4:04:23 PM UTC+2 a2nd...@gmail.com wrote:

> "f47ba92cf7" is the hashed password i.e.
>
> "f47ba92cf7" = getHash("test2.xcom"+"pw2")
>
> The following is the getHash code I'm using:
>
> static String getHash(String str) {
> return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
> }
> public static String dumpBytes(byte[] buffer) {
> if (buffer == null) {
> return "";
> }
> StringBuilder sb = new StringBuilder();
> sb.setLength(0);
> for (int i = 0; i < buffer.length; i++) {
> sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
> .append((char) (HEX_CHAR[buffer[i] & 0x000F]));
> }
> return sb.toString();
> }
>
> BTW What time zone are you in?
>
> -Dennis
> On Sunday, March 14, 2021 at 10:08:01 PM UTC-4 Shai Almog wrote:
>
>> Thanks!
>> I'm trying to reproduce it and noticed I'm still missing the code of 
>> getHash.
>>
>> On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".
>>>
>>> On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:
>>>
 Sure, You can use "te...@x.com" for the email (user id) and "pw2" 
 as the password.
>>>
>>>

 On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:

> Thanks, is it possible to create a dummy username/password combo 
> with no permissions so we can test this?
>
> On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> The server URL is https://www.symdesigns.com. I have a web page 
>> at symdesigns.com/ShoppingGenie/index.html and the server php is 
>> /symdesigns.com/php/export.php .
>>
>> On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:
>>
>>> Interesting, can you expose the server URL so we can run this 
>>> test case and see?
>>>
>>> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 I switched to using Util.readToString() and still no joy on the 
 iphone device.
 The code still works ok on the simulator and on also on a real 
 Android device.

 On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog 
 wrote:

> Try using String ans = Util.readToString(); which might be 
> better. 
> Is the code still working on the simulator after the changes?
> Is it working on Android?
>
> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 
> a2nd...@gmail.com wrote:
>
>> Replacing flush() with close() didn't make a difference. 
>> Here's the code I used without the buffer:
>>
>> os = link.getOutputStream();
>> 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-16 Thread Shai Almog
I'll look into it. It works in the simulator but I have a couple of issues 
with my environment so it will take me. a couple of days to reproduce it on 
a device.

On Tuesday, March 16, 2021 at 11:37:29 PM UTC+2 a2nd...@gmail.com wrote:

>
> BTW, It seems to work ok on the android device.
> On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:
>
>> The URL is wrong. It should be: "https://symdesigns.com/php/export.php;. 
>> With that change your test code seems to work ok on the simulator 
>> (returns ok) but
>> on the device it doesn't (returns nok); When I look at the server logs it 
>> still seems to receive 
>> a blank email and password when run from the device.
>> On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:
>>
>>> I ran this test case but I'm getting an error from the server in the 
>>> "success" dialog:
>>>
>>> Form hi = new Form("Hi World", BoxLayout.y());
>>> Button test = new Button("Test");
>>> hi.add(test);
>>> test.addActionListener(e -> {
>>>try {
>>>  URL url = new URL("
>>> https://symdesigns.com/symdesigns.com/php/export.php;);
>>>  URL.URLConnection link = url.openConnection();
>>>  link.setDoOutput(true);
>>>  link.setDoInput(true);
>>>  OutputStream os = link.getOutputStream();
>>>  os.write(("te...@x.com\n").getBytes());
>>>  os.write(("f47ba92cf7\n").getBytes());
>>>  os.close();
>>>
>>>  InputStream is = link.getInputStream();
>>>  String ans = Util.readToString(is);
>>>
>>>  Dialog.show("Success", ans, "OK", null);
>>>} catch(Exception err) {
>>>  Dialog.show("Error", err.toString(), "OK", null);
>>>  Log.p("URL error");
>>>  Log.e(err);
>>>}
>>> });
>>>
>>> hi.show();
>>>
>>> On Monday, March 15, 2021 at 4:04:23 PM UTC+2 a2nd...@gmail.com wrote:
>>>
 "f47ba92cf7" is the hashed password i.e.

 "f47ba92cf7" = getHash("test2.xcom"+"pw2")

 The following is the getHash code I'm using:

 static String getHash(String str) {
 return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
 }
 public static String dumpBytes(byte[] buffer) {
 if (buffer == null) {
 return "";
 }
 StringBuilder sb = new StringBuilder();
 sb.setLength(0);
 for (int i = 0; i < buffer.length; i++) {
 sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
 .append((char) (HEX_CHAR[buffer[i] & 0x000F]));
 }
 return sb.toString();
 }

 BTW What time zone are you in?

 -Dennis
 On Sunday, March 14, 2021 at 10:08:01 PM UTC-4 Shai Almog wrote:

> Thanks!
> I'm trying to reproduce it and noticed I'm still missing the code of 
> getHash.
>
> On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com wrote:
>
>> I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".
>>
>> On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:
>>
>>> Sure, You can use "te...@x.com" for the email (user id) and "pw2" 
>>> as the password.
>>
>>
>>>
>>> On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:
>>>
 Thanks, is it possible to create a dummy username/password combo 
 with no permissions so we can test this?

 On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com 
 wrote:

> The server URL is https://www.symdesigns.com. I have a web page 
> at symdesigns.com/ShoppingGenie/index.html and the server php is /
> symdesigns.com/php/export.php .
>
> On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:
>
>> Interesting, can you expose the server URL so we can run this 
>> test case and see?
>>
>> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> I switched to using Util.readToString() and still no joy on the 
>>> iphone device.
>>> The code still works ok on the simulator and on also on a real 
>>> Android device.
>>>
>>> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog 
>>> wrote:
>>>
 Try using String ans = Util.readToString(); which might be 
 better. 
 Is the code still working on the simulator after the changes?
 Is it working on Android?

 On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 
 a2nd...@gmail.com wrote:

> Replacing flush() with close() didn't make a difference. 
> Here's the code I used without the buffer:
>
> os = link.getOutputStream();
> os.write((nemail + "\n").getBytes());
> pwHash = getHash(nemail + npasswd);
> os.write((pwHash + "\n").getBytes());
> os.close();
>
> is = link.getInputStream();
> 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-16 Thread Dennis Rogers

BTW, It seems to work ok on the android device.
On Tuesday, March 16, 2021 at 5:13:30 PM UTC-4 Dennis Rogers wrote:

> The URL is wrong. It should be: "https://symdesigns.com/php/export.php;. 
> With that change your test code seems to work ok on the simulator (returns 
> ok) but
> on the device it doesn't (returns nok); When I look at the server logs it 
> still seems to receive 
> a blank email and password when run from the device.
> On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:
>
>> I ran this test case but I'm getting an error from the server in the 
>> "success" dialog:
>>
>> Form hi = new Form("Hi World", BoxLayout.y());
>> Button test = new Button("Test");
>> hi.add(test);
>> test.addActionListener(e -> {
>>try {
>>  URL url = new URL("
>> https://symdesigns.com/symdesigns.com/php/export.php;);
>>  URL.URLConnection link = url.openConnection();
>>  link.setDoOutput(true);
>>  link.setDoInput(true);
>>  OutputStream os = link.getOutputStream();
>>  os.write(("te...@x.com\n").getBytes());
>>  os.write(("f47ba92cf7\n").getBytes());
>>  os.close();
>>
>>  InputStream is = link.getInputStream();
>>  String ans = Util.readToString(is);
>>
>>  Dialog.show("Success", ans, "OK", null);
>>} catch(Exception err) {
>>  Dialog.show("Error", err.toString(), "OK", null);
>>  Log.p("URL error");
>>  Log.e(err);
>>}
>> });
>>
>> hi.show();
>>
>> On Monday, March 15, 2021 at 4:04:23 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> "f47ba92cf7" is the hashed password i.e.
>>>
>>> "f47ba92cf7" = getHash("test2.xcom"+"pw2")
>>>
>>> The following is the getHash code I'm using:
>>>
>>> static String getHash(String str) {
>>> return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
>>> }
>>> public static String dumpBytes(byte[] buffer) {
>>> if (buffer == null) {
>>> return "";
>>> }
>>> StringBuilder sb = new StringBuilder();
>>> sb.setLength(0);
>>> for (int i = 0; i < buffer.length; i++) {
>>> sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
>>> .append((char) (HEX_CHAR[buffer[i] & 0x000F]));
>>> }
>>> return sb.toString();
>>> }
>>>
>>> BTW What time zone are you in?
>>>
>>> -Dennis
>>> On Sunday, March 14, 2021 at 10:08:01 PM UTC-4 Shai Almog wrote:
>>>
 Thanks!
 I'm trying to reproduce it and noticed I'm still missing the code of 
 getHash.

 On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com wrote:

> I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".
>
> On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:
>
>> Sure, You can use "te...@x.com" for the email (user id) and "pw2" as 
>> the password.
>
>
>>
>> On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:
>>
>>> Thanks, is it possible to create a dummy username/password combo 
>>> with no permissions so we can test this?
>>>
>>> On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 The server URL is https://www.symdesigns.com. I have a web page at 
 symdesigns.com/ShoppingGenie/index.html and the server php is /
 symdesigns.com/php/export.php .

 On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:

> Interesting, can you expose the server URL so we can run this test 
> case and see?
>
> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> I switched to using Util.readToString() and still no joy on the 
>> iphone device.
>> The code still works ok on the simulator and on also on a real 
>> Android device.
>>
>> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog 
>> wrote:
>>
>>> Try using String ans = Util.readToString(); which might be 
>>> better. 
>>> Is the code still working on the simulator after the changes?
>>> Is it working on Android?
>>>
>>> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 
>>> a2nd...@gmail.com wrote:
>>>
 Replacing flush() with close() didn't make a difference. Here's 
 the code I used without the buffer:

 os = link.getOutputStream();
 os.write((nemail + "\n").getBytes());
 pwHash = getHash(nemail + npasswd);
 os.write((pwHash + "\n").getBytes());
 os.close();

 is = link.getInputStream();
 String ans = readLine(is);

 static String readLine(InputStream stream) {
 byte[] b = new byte[80];
 String s = "";
 int i = 0;
 try {
 b[i] = (byte) stream.read();
 while((b[i] != 10 && (b[i] != 13))) {
 i++;

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-16 Thread Dennis Rogers
The URL is wrong. It should be: "https://symdesigns.com/php/export.php;. 
With that change your test code seems to work ok on the simulator (returns 
ok) but
on the device it doesn't (returns nok); When I look at the server logs it 
still seems to receive 
a blank email and password when run from the device.
On Monday, March 15, 2021 at 10:40:12 PM UTC-4 Shai Almog wrote:

> I ran this test case but I'm getting an error from the server in the 
> "success" dialog:
>
> Form hi = new Form("Hi World", BoxLayout.y());
> Button test = new Button("Test");
> hi.add(test);
> test.addActionListener(e -> {
>try {
>  URL url = new URL("
> https://symdesigns.com/symdesigns.com/php/export.php;);
>  URL.URLConnection link = url.openConnection();
>  link.setDoOutput(true);
>  link.setDoInput(true);
>  OutputStream os = link.getOutputStream();
>  os.write(("te...@x.com\n").getBytes());
>  os.write(("f47ba92cf7\n").getBytes());
>  os.close();
>
>  InputStream is = link.getInputStream();
>  String ans = Util.readToString(is);
>
>  Dialog.show("Success", ans, "OK", null);
>} catch(Exception err) {
>  Dialog.show("Error", err.toString(), "OK", null);
>  Log.p("URL error");
>  Log.e(err);
>}
> });
>
> hi.show();
>
> On Monday, March 15, 2021 at 4:04:23 PM UTC+2 a2nd...@gmail.com wrote:
>
>> "f47ba92cf7" is the hashed password i.e.
>>
>> "f47ba92cf7" = getHash("test2.xcom"+"pw2")
>>
>> The following is the getHash code I'm using:
>>
>> static String getHash(String str) {
>> return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
>> }
>> public static String dumpBytes(byte[] buffer) {
>> if (buffer == null) {
>> return "";
>> }
>> StringBuilder sb = new StringBuilder();
>> sb.setLength(0);
>> for (int i = 0; i < buffer.length; i++) {
>> sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
>> .append((char) (HEX_CHAR[buffer[i] & 0x000F]));
>> }
>> return sb.toString();
>> }
>>
>> BTW What time zone are you in?
>>
>> -Dennis
>> On Sunday, March 14, 2021 at 10:08:01 PM UTC-4 Shai Almog wrote:
>>
>>> Thanks!
>>> I'm trying to reproduce it and noticed I'm still missing the code of 
>>> getHash.
>>>
>>> On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com wrote:
>>>
 I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".

 On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:

> Sure, You can use "te...@x.com" for the email (user id) and "pw2" as 
> the password.


>
> On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:
>
>> Thanks, is it possible to create a dummy username/password combo with 
>> no permissions so we can test this?
>>
>> On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> The server URL is https://www.symdesigns.com. I have a web page at 
>>> symdesigns.com/ShoppingGenie/index.html and the server php is /
>>> symdesigns.com/php/export.php .
>>>
>>> On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:
>>>
 Interesting, can you expose the server URL so we can run this test 
 case and see?

 On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com 
 wrote:

> I switched to using Util.readToString() and still no joy on the 
> iphone device.
> The code still works ok on the simulator and on also on a real 
> Android device.
>
> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:
>
>> Try using String ans = Util.readToString(); which might be 
>> better. 
>> Is the code still working on the simulator after the changes?
>> Is it working on Android?
>>
>> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 
>> a2nd...@gmail.com wrote:
>>
>>> Replacing flush() with close() didn't make a difference. Here's 
>>> the code I used without the buffer:
>>>
>>> os = link.getOutputStream();
>>> os.write((nemail + "\n").getBytes());
>>> pwHash = getHash(nemail + npasswd);
>>> os.write((pwHash + "\n").getBytes());
>>> os.close();
>>>
>>> is = link.getInputStream();
>>> String ans = readLine(is);
>>>
>>> static String readLine(InputStream stream) {
>>> byte[] b = new byte[80];
>>> String s = "";
>>> int i = 0;
>>> try {
>>> b[i] = (byte) stream.read();
>>> while((b[i] != 10 && (b[i] != 13))) {
>>> i++;
>>> b[i] = (byte) stream.read();
>>> }
>>> b[i] = 0;
>>>return new String(b,0,i);
>>> } catch(IOException e) {
>>> Log.e(e);
>>> return null:
>>> }
>>> } 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-15 Thread Shai Almog
I ran this test case but I'm getting an error from the server in the 
"success" dialog:

Form hi = new Form("Hi World", BoxLayout.y());
Button test = new Button("Test");
hi.add(test);
test.addActionListener(e -> {
   try {
 URL url = new URL(
"https://symdesigns.com/symdesigns.com/php/export.php;);
 URL.URLConnection link = url.openConnection();
 link.setDoOutput(true);
 link.setDoInput(true);
 OutputStream os = link.getOutputStream();
 os.write(("te...@x.com\n").getBytes());
 os.write(("f47ba92cf7\n").getBytes());
 os.close();

 InputStream is = link.getInputStream();
 String ans = Util.readToString(is);

 Dialog.show("Success", ans, "OK", null);
   } catch(Exception err) {
 Dialog.show("Error", err.toString(), "OK", null);
 Log.p("URL error");
 Log.e(err);
   }
});

hi.show();

On Monday, March 15, 2021 at 4:04:23 PM UTC+2 a2nd...@gmail.com wrote:

> "f47ba92cf7" is the hashed password i.e.
>
> "f47ba92cf7" = getHash("test2.xcom"+"pw2")
>
> The following is the getHash code I'm using:
>
> static String getHash(String str) {
> return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
> }
> public static String dumpBytes(byte[] buffer) {
> if (buffer == null) {
> return "";
> }
> StringBuilder sb = new StringBuilder();
> sb.setLength(0);
> for (int i = 0; i < buffer.length; i++) {
> sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
> .append((char) (HEX_CHAR[buffer[i] & 0x000F]));
> }
> return sb.toString();
> }
>
> BTW What time zone are you in?
>
> -Dennis
> On Sunday, March 14, 2021 at 10:08:01 PM UTC-4 Shai Almog wrote:
>
>> Thanks!
>> I'm trying to reproduce it and noticed I'm still missing the code of 
>> getHash.
>>
>> On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".
>>>
>>> On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:
>>>
 Sure, You can use "te...@x.com" for the email (user id) and "pw2" as 
 the password.
>>>
>>>

 On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:

> Thanks, is it possible to create a dummy username/password combo with 
> no permissions so we can test this?
>
> On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> The server URL is https://www.symdesigns.com. I have a web page at 
>> symdesigns.com/ShoppingGenie/index.html and the server php is /
>> symdesigns.com/php/export.php .
>>
>> On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:
>>
>>> Interesting, can you expose the server URL so we can run this test 
>>> case and see?
>>>
>>> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 I switched to using Util.readToString() and still no joy on the 
 iphone device.
 The code still works ok on the simulator and on also on a real 
 Android device.

 On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:

> Try using String ans = Util.readToString(); which might be better. 
> Is the code still working on the simulator after the changes?
> Is it working on Android?
>
> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> Replacing flush() with close() didn't make a difference. Here's 
>> the code I used without the buffer:
>>
>> os = link.getOutputStream();
>> os.write((nemail + "\n").getBytes());
>> pwHash = getHash(nemail + npasswd);
>> os.write((pwHash + "\n").getBytes());
>> os.close();
>>
>> is = link.getInputStream();
>> String ans = readLine(is);
>>
>> static String readLine(InputStream stream) {
>> byte[] b = new byte[80];
>> String s = "";
>> int i = 0;
>> try {
>> b[i] = (byte) stream.read();
>> while((b[i] != 10 && (b[i] != 13))) {
>> i++;
>> b[i] = (byte) stream.read();
>> }
>> b[i] = 0;
>>return new String(b,0,i);
>> } catch(IOException e) {
>> Log.e(e);
>> return null:
>> }
>> } 
>> On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:
>>
>>> Can you include the full code after removing the buffers?
>>> Also try replacing flush() with close(). That might help.
>>>
>>> On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 I'm able to access all the websites on that IP from the device. 
 I also tried accessing the reply from the server without the 
 BufferedInputStream with no luck.

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-15 Thread Dennis Rogers
"f47ba92cf7" is the hashed password i.e.

"f47ba92cf7" = getHash("test2.xcom"+"pw2")

The following is the getHash code I'm using:

static String getHash(String str) {
return dumpBytes(MD5.computeMD5(str.getBytes())).substring(0,10);
}
public static String dumpBytes(byte[] buffer) {
if (buffer == null) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.setLength(0);
for (int i = 0; i < buffer.length; i++) {
sb.append((char) (HEX_CHAR[(buffer[i] & 0x00F0) >> 4]))
.append((char) (HEX_CHAR[buffer[i] & 0x000F]));
}
return sb.toString();
}

BTW What time zone are you in?

-Dennis
On Sunday, March 14, 2021 at 10:08:01 PM UTC-4 Shai Almog wrote:

> Thanks!
> I'm trying to reproduce it and noticed I'm still missing the code of 
> getHash.
>
> On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com wrote:
>
>> I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".
>>
>> On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:
>>
>>> Sure, You can use "te...@x.com" for the email (user id) and "pw2" as 
>>> the password.
>>
>>
>>>
>>> On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:
>>>
 Thanks, is it possible to create a dummy username/password combo with 
 no permissions so we can test this?

 On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com 
 wrote:

> The server URL is https://www.symdesigns.com. I have a web page at 
> symdesigns.com/ShoppingGenie/index.html and the server php is /
> symdesigns.com/php/export.php .
>
> On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:
>
>> Interesting, can you expose the server URL so we can run this test 
>> case and see?
>>
>> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> I switched to using Util.readToString() and still no joy on the 
>>> iphone device.
>>> The code still works ok on the simulator and on also on a real 
>>> Android device.
>>>
>>> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:
>>>
 Try using String ans = Util.readToString(); which might be better. 
 Is the code still working on the simulator after the changes?
 Is it working on Android?

 On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com 
 wrote:

> Replacing flush() with close() didn't make a difference. Here's 
> the code I used without the buffer:
>
> os = link.getOutputStream();
> os.write((nemail + "\n").getBytes());
> pwHash = getHash(nemail + npasswd);
> os.write((pwHash + "\n").getBytes());
> os.close();
>
> is = link.getInputStream();
> String ans = readLine(is);
>
> static String readLine(InputStream stream) {
> byte[] b = new byte[80];
> String s = "";
> int i = 0;
> try {
> b[i] = (byte) stream.read();
> while((b[i] != 10 && (b[i] != 13))) {
> i++;
> b[i] = (byte) stream.read();
> }
> b[i] = 0;
>return new String(b,0,i);
> } catch(IOException e) {
> Log.e(e);
> return null:
> }
> } 
> On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:
>
>> Can you include the full code after removing the buffers?
>> Also try replacing flush() with close(). That might help.
>>
>> On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> I'm able to access all the websites on that IP from the device. 
>>> I also tried accessing the reply from the server without the 
>>> BufferedInputStream with no luck.
>>>
>>> The certificate I used was one I bought from bluehost.com who 
>>> hosts my server.
>>>
>>> On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:
>>>
 With valid (not self signed) certificate?
 Is it a publicly visible IP accessible from the device?

 On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com 
 wrote:

> Yes, the site is https. To make sure, I tested it using the 
> Qualys ssl checker and I access it with the https:// prefix.
>
> --Dennis
> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>
>> I meant the Rest class.
>>
>> Sorry I neglected to ask something basic. Is the URL HTTPS?
>> If not iOS will fail by default. You can use this as a 
>> workaround: 
>> https://www.codenameone.com/blog/ios-http-urls.html
>> On Sunday, 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-14 Thread Shai Almog
Thanks!
I'm trying to reproduce it and noticed I'm still missing the code of 
getHash.

On Sunday, March 14, 2021 at 5:18:47 PM UTC+2 a2nd...@gmail.com wrote:

> I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".
>
> On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:
>
>> Sure, You can use "te...@x.com" for the email (user id) and "pw2" as the 
>> password.
>
>
>>
>> On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:
>>
>>> Thanks, is it possible to create a dummy username/password combo with no 
>>> permissions so we can test this?
>>>
>>> On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com wrote:
>>>
 The server URL is https://www.symdesigns.com. I have a web page at 
 symdesigns.com/ShoppingGenie/index.html and the server php is /
 symdesigns.com/php/export.php .

 On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:

> Interesting, can you expose the server URL so we can run this test 
> case and see?
>
> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> I switched to using Util.readToString() and still no joy on the 
>> iphone device.
>> The code still works ok on the simulator and on also on a real 
>> Android device.
>>
>> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:
>>
>>> Try using String ans = Util.readToString(); which might be better. 
>>> Is the code still working on the simulator after the changes?
>>> Is it working on Android?
>>>
>>> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 Replacing flush() with close() didn't make a difference. Here's the 
 code I used without the buffer:

 os = link.getOutputStream();
 os.write((nemail + "\n").getBytes());
 pwHash = getHash(nemail + npasswd);
 os.write((pwHash + "\n").getBytes());
 os.close();

 is = link.getInputStream();
 String ans = readLine(is);

 static String readLine(InputStream stream) {
 byte[] b = new byte[80];
 String s = "";
 int i = 0;
 try {
 b[i] = (byte) stream.read();
 while((b[i] != 10 && (b[i] != 13))) {
 i++;
 b[i] = (byte) stream.read();
 }
 b[i] = 0;
return new String(b,0,i);
 } catch(IOException e) {
 Log.e(e);
 return null:
 }
 } 
 On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:

> Can you include the full code after removing the buffers?
> Also try replacing flush() with close(). That might help.
>
> On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> I'm able to access all the websites on that IP from the device. I 
>> also tried accessing the reply from the server without the 
>> BufferedInputStream with no luck.
>>
>> The certificate I used was one I bought from bluehost.com who 
>> hosts my server.
>>
>> On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:
>>
>>> With valid (not self signed) certificate?
>>> Is it a publicly visible IP accessible from the device?
>>>
>>> On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 Yes, the site is https. To make sure, I tested it using the 
 Qualys ssl checker and I access it with the https:// prefix.

 --Dennis
 On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:

> I meant the Rest class.
>
> Sorry I neglected to ask something basic. Is the URL HTTPS?
> If not iOS will fail by default. You can use this as a 
> workaround: 
> https://www.codenameone.com/blog/ios-http-urls.html
> On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> Yes I'm using codename1.io.URL.
>>
>> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers 
>> wrote:
>>
>>> Sorry but I'm still having problems. I tried using 
>>> unbuffered IO but with the same result (works on the simulator 
>>> but not on 
>>> the device). Also the code I sent you was followed by:
>>>
>>> // Get buffered Input stream
>>>
>>> is = link.getInputStream();
>>> BufferedInputStream binp = new BufferedInputStream(is);
>>> // Get reply
>>> String ans = readLine(binp);

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-14 Thread Dennis Rogers
I forgot to tell you. The password "pw2" is hashed to "f47ba92cf7".

On Sunday, March 14, 2021 at 11:12:37 AM UTC-4 Dennis Rogers wrote:

> Sure, You can use "te...@x.com" for the email (user id) and "pw2" as the 
> password.
>
> On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:
>
>> Thanks, is it possible to create a dummy username/password combo with no 
>> permissions so we can test this?
>>
>> On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> The server URL is https://www.symdesigns.com. I have a web page at 
>>> symdesigns.com/ShoppingGenie/index.html and the server php is /
>>> symdesigns.com/php/export.php .
>>>
>>> On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:
>>>
 Interesting, can you expose the server URL so we can run this test case 
 and see?

 On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com wrote:

> I switched to using Util.readToString() and still no joy on the iphone 
> device.
> The code still works ok on the simulator and on also on a real Android 
> device.
>
> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:
>
>> Try using String ans = Util.readToString(); which might be better. 
>> Is the code still working on the simulator after the changes?
>> Is it working on Android?
>>
>> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> Replacing flush() with close() didn't make a difference. Here's the 
>>> code I used without the buffer:
>>>
>>> os = link.getOutputStream();
>>> os.write((nemail + "\n").getBytes());
>>> pwHash = getHash(nemail + npasswd);
>>> os.write((pwHash + "\n").getBytes());
>>> os.close();
>>>
>>> is = link.getInputStream();
>>> String ans = readLine(is);
>>>
>>> static String readLine(InputStream stream) {
>>> byte[] b = new byte[80];
>>> String s = "";
>>> int i = 0;
>>> try {
>>> b[i] = (byte) stream.read();
>>> while((b[i] != 10 && (b[i] != 13))) {
>>> i++;
>>> b[i] = (byte) stream.read();
>>> }
>>> b[i] = 0;
>>>return new String(b,0,i);
>>> } catch(IOException e) {
>>> Log.e(e);
>>> return null:
>>> }
>>> } 
>>> On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:
>>>
 Can you include the full code after removing the buffers?
 Also try replacing flush() with close(). That might help.

 On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com 
 wrote:

> I'm able to access all the websites on that IP from the device. I 
> also tried accessing the reply from the server without the 
> BufferedInputStream with no luck.
>
> The certificate I used was one I bought from bluehost.com who 
> hosts my server.
>
> On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:
>
>> With valid (not self signed) certificate?
>> Is it a publicly visible IP accessible from the device?
>>
>> On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> Yes, the site is https. To make sure, I tested it using the 
>>> Qualys ssl checker and I access it with the https:// prefix.
>>>
>>> --Dennis
>>> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>>>
 I meant the Rest class.

 Sorry I neglected to ask something basic. Is the URL HTTPS?
 If not iOS will fail by default. You can use this as a 
 workaround: https://www.codenameone.com/blog/ios-http-urls.html
 On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com 
 wrote:

> Yes I'm using codename1.io.URL.
>
> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers 
> wrote:
>
>> Sorry but I'm still having problems. I tried using unbuffered 
>> IO but with the same result (works on the simulator but not on 
>> the device). 
>> Also the code I sent you was followed by:
>>
>> // Get buffered Input stream
>>
>> is = link.getInputStream();
>> BufferedInputStream binp = new BufferedInputStream(is);
>> // Get reply
>> String ans = readLine(binp);
>>
>> which I think would qualify as asking for a response from the 
>> server. BTW this is all being done on a separate thread.
>>
>> I'm learning about the REST protocol but think this should 
>> work.
>>
>> -Dennis

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-14 Thread Dennis Rogers
Sure, You can use "te...@x.com" for the email (user id) and "pw2" as the 
password.

On Saturday, March 13, 2021 at 10:03:59 PM UTC-5 Shai Almog wrote:

> Thanks, is it possible to create a dummy username/password combo with no 
> permissions so we can test this?
>
> On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com wrote:
>
>> The server URL is https://www.symdesigns.com. I have a web page at 
>> symdesigns.com/ShoppingGenie/index.html and the server php is /
>> symdesigns.com/php/export.php .
>>
>> On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:
>>
>>> Interesting, can you expose the server URL so we can run this test case 
>>> and see?
>>>
>>> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com wrote:
>>>
 I switched to using Util.readToString() and still no joy on the iphone 
 device.
 The code still works ok on the simulator and on also on a real Android 
 device.

 On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:

> Try using String ans = Util.readToString(); which might be better. 
> Is the code still working on the simulator after the changes?
> Is it working on Android?
>
> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> Replacing flush() with close() didn't make a difference. Here's the 
>> code I used without the buffer:
>>
>> os = link.getOutputStream();
>> os.write((nemail + "\n").getBytes());
>> pwHash = getHash(nemail + npasswd);
>> os.write((pwHash + "\n").getBytes());
>> os.close();
>>
>> is = link.getInputStream();
>> String ans = readLine(is);
>>
>> static String readLine(InputStream stream) {
>> byte[] b = new byte[80];
>> String s = "";
>> int i = 0;
>> try {
>> b[i] = (byte) stream.read();
>> while((b[i] != 10 && (b[i] != 13))) {
>> i++;
>> b[i] = (byte) stream.read();
>> }
>> b[i] = 0;
>>return new String(b,0,i);
>> } catch(IOException e) {
>> Log.e(e);
>> return null:
>> }
>> } 
>> On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:
>>
>>> Can you include the full code after removing the buffers?
>>> Also try replacing flush() with close(). That might help.
>>>
>>> On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 I'm able to access all the websites on that IP from the device. I 
 also tried accessing the reply from the server without the 
 BufferedInputStream with no luck.

 The certificate I used was one I bought from bluehost.com who 
 hosts my server.

 On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:

> With valid (not self signed) certificate?
> Is it a publicly visible IP accessible from the device?
>
> On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> Yes, the site is https. To make sure, I tested it using the 
>> Qualys ssl checker and I access it with the https:// prefix.
>>
>> --Dennis
>> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>>
>>> I meant the Rest class.
>>>
>>> Sorry I neglected to ask something basic. Is the URL HTTPS?
>>> If not iOS will fail by default. You can use this as a 
>>> workaround: https://www.codenameone.com/blog/ios-http-urls.html
>>> On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 Yes I'm using codename1.io.URL.

 On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers 
 wrote:

> Sorry but I'm still having problems. I tried using unbuffered 
> IO but with the same result (works on the simulator but not on 
> the device). 
> Also the code I sent you was followed by:
>
> // Get buffered Input stream
>
> is = link.getInputStream();
> BufferedInputStream binp = new BufferedInputStream(is);
> // Get reply
> String ans = readLine(binp);
>
> which I think would qualify as asking for a response from the 
> server. BTW this is all being done on a separate thread.
>
> I'm learning about the REST protocol but think this should 
> work.
>
> -Dennis
> On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog 
> wrote:
>
>> Are you using com.codenameone.io.URL ?
>> I would recommend avoiding BufferedOutputStream in Codename 
>> One as all 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-13 Thread Shai Almog
Thanks, is it possible to create a dummy username/password combo with no 
permissions so we can test this?

On Saturday, March 13, 2021 at 2:59:16 PM UTC+2 a2nd...@gmail.com wrote:

> The server URL is https://www.symdesigns.com. I have a web page at 
> symdesigns.com/ShoppingGenie/index.html and the server php is /
> symdesigns.com/php/export.php .
>
> On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:
>
>> Interesting, can you expose the server URL so we can run this test case 
>> and see?
>>
>> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> I switched to using Util.readToString() and still no joy on the iphone 
>>> device.
>>> The code still works ok on the simulator and on also on a real Android 
>>> device.
>>>
>>> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:
>>>
 Try using String ans = Util.readToString(); which might be better. 
 Is the code still working on the simulator after the changes?
 Is it working on Android?

 On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com 
 wrote:

> Replacing flush() with close() didn't make a difference. Here's the 
> code I used without the buffer:
>
> os = link.getOutputStream();
> os.write((nemail + "\n").getBytes());
> pwHash = getHash(nemail + npasswd);
> os.write((pwHash + "\n").getBytes());
> os.close();
>
> is = link.getInputStream();
> String ans = readLine(is);
>
> static String readLine(InputStream stream) {
> byte[] b = new byte[80];
> String s = "";
> int i = 0;
> try {
> b[i] = (byte) stream.read();
> while((b[i] != 10 && (b[i] != 13))) {
> i++;
> b[i] = (byte) stream.read();
> }
> b[i] = 0;
>return new String(b,0,i);
> } catch(IOException e) {
> Log.e(e);
> return null:
> }
> } 
> On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:
>
>> Can you include the full code after removing the buffers?
>> Also try replacing flush() with close(). That might help.
>>
>> On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> I'm able to access all the websites on that IP from the device. I 
>>> also tried accessing the reply from the server without the 
>>> BufferedInputStream with no luck.
>>>
>>> The certificate I used was one I bought from bluehost.com who hosts 
>>> my server.
>>>
>>> On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:
>>>
 With valid (not self signed) certificate?
 Is it a publicly visible IP accessible from the device?

 On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com 
 wrote:

> Yes, the site is https. To make sure, I tested it using the Qualys 
> ssl checker and I access it with the https:// prefix.
>
> --Dennis
> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>
>> I meant the Rest class.
>>
>> Sorry I neglected to ask something basic. Is the URL HTTPS?
>> If not iOS will fail by default. You can use this as a 
>> workaround: https://www.codenameone.com/blog/ios-http-urls.html
>> On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> Yes I'm using codename1.io.URL.
>>>
>>> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers 
>>> wrote:
>>>
 Sorry but I'm still having problems. I tried using unbuffered 
 IO but with the same result (works on the simulator but not on the 
 device). 
 Also the code I sent you was followed by:

 // Get buffered Input stream

 is = link.getInputStream();
 BufferedInputStream binp = new BufferedInputStream(is);
 // Get reply
 String ans = readLine(binp);

 which I think would qualify as asking for a response from the 
 server. BTW this is all being done on a separate thread.

 I'm learning about the REST protocol but think this should work.

 -Dennis
 On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:

> Are you using com.codenameone.io.URL ?
> I would recommend avoiding BufferedOutputStream in Codename 
> One as all streams are buffered by default in Codename One.
> You also need to fetch the result for the request to finish. 
> It won't happen until you try to get a response from the server.
>
> I would recommend using APIs like the "Rest" API which is 
> simpler 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-13 Thread Dennis Rogers
The server URL is https://www.symdesigns.com. I have a web page at 
symdesigns.com/ShoppingGenie/index.html and the server php is 
/symdesigns.com/php/export.php .

On Friday, March 12, 2021 at 11:45:51 PM UTC-5 Shai Almog wrote:

> Interesting, can you expose the server URL so we can run this test case 
> and see?
>
> On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com wrote:
>
>> I switched to using Util.readToString() and still no joy on the iphone 
>> device.
>> The code still works ok on the simulator and on also on a real Android 
>> device.
>>
>> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:
>>
>>> Try using String ans = Util.readToString(); which might be better. 
>>> Is the code still working on the simulator after the changes?
>>> Is it working on Android?
>>>
>>> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 Replacing flush() with close() didn't make a difference. Here's the 
 code I used without the buffer:

 os = link.getOutputStream();
 os.write((nemail + "\n").getBytes());
 pwHash = getHash(nemail + npasswd);
 os.write((pwHash + "\n").getBytes());
 os.close();

 is = link.getInputStream();
 String ans = readLine(is);

 static String readLine(InputStream stream) {
 byte[] b = new byte[80];
 String s = "";
 int i = 0;
 try {
 b[i] = (byte) stream.read();
 while((b[i] != 10 && (b[i] != 13))) {
 i++;
 b[i] = (byte) stream.read();
 }
 b[i] = 0;
return new String(b,0,i);
 } catch(IOException e) {
 Log.e(e);
 return null:
 }
 } 
 On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:

> Can you include the full code after removing the buffers?
> Also try replacing flush() with close(). That might help.
>
> On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com wrote:
>
>> I'm able to access all the websites on that IP from the device. I 
>> also tried accessing the reply from the server without the 
>> BufferedInputStream with no luck.
>>
>> The certificate I used was one I bought from bluehost.com who hosts 
>> my server.
>>
>> On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:
>>
>>> With valid (not self signed) certificate?
>>> Is it a publicly visible IP accessible from the device?
>>>
>>> On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 Yes, the site is https. To make sure, I tested it using the Qualys 
 ssl checker and I access it with the https:// prefix.

 --Dennis
 On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:

> I meant the Rest class.
>
> Sorry I neglected to ask something basic. Is the URL HTTPS?
> If not iOS will fail by default. You can use this as a workaround: 
> https://www.codenameone.com/blog/ios-http-urls.html
> On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> Yes I'm using codename1.io.URL.
>>
>> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:
>>
>>> Sorry but I'm still having problems. I tried using unbuffered IO 
>>> but with the same result (works on the simulator but not on the 
>>> device). 
>>> Also the code I sent you was followed by:
>>>
>>> // Get buffered Input stream
>>>
>>> is = link.getInputStream();
>>> BufferedInputStream binp = new BufferedInputStream(is);
>>> // Get reply
>>> String ans = readLine(binp);
>>>
>>> which I think would qualify as asking for a response from the 
>>> server. BTW this is all being done on a separate thread.
>>>
>>> I'm learning about the REST protocol but think this should work.
>>>
>>> -Dennis
>>> On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:
>>>
 Are you using com.codenameone.io.URL ?
 I would recommend avoiding BufferedOutputStream in Codename One 
 as all streams are buffered by default in Codename One.
 You also need to fetch the result for the request to finish. It 
 won't happen until you try to get a response from the server.

 I would recommend using APIs like the "Rest" API which is 
 simpler to use and doesn't require threading.

 On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 
 a2nd...@gmail.com wrote:

> I have the following code that I use to send an email and 
> password to my server. It works fine on the simulator but fails 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-12 Thread Shai Almog
Interesting, can you expose the server URL so we can run this test case and 
see?

On Friday, March 12, 2021 at 10:57:24 PM UTC+2 a2nd...@gmail.com wrote:

> I switched to using Util.readToString() and still no joy on the iphone 
> device.
> The code still works ok on the simulator and on also on a real Android 
> device.
>
> On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:
>
>> Try using String ans = Util.readToString(); which might be better. 
>> Is the code still working on the simulator after the changes?
>> Is it working on Android?
>>
>> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> Replacing flush() with close() didn't make a difference. Here's the code 
>>> I used without the buffer:
>>>
>>> os = link.getOutputStream();
>>> os.write((nemail + "\n").getBytes());
>>> pwHash = getHash(nemail + npasswd);
>>> os.write((pwHash + "\n").getBytes());
>>> os.close();
>>>
>>> is = link.getInputStream();
>>> String ans = readLine(is);
>>>
>>> static String readLine(InputStream stream) {
>>> byte[] b = new byte[80];
>>> String s = "";
>>> int i = 0;
>>> try {
>>> b[i] = (byte) stream.read();
>>> while((b[i] != 10 && (b[i] != 13))) {
>>> i++;
>>> b[i] = (byte) stream.read();
>>> }
>>> b[i] = 0;
>>>return new String(b,0,i);
>>> } catch(IOException e) {
>>> Log.e(e);
>>> return null:
>>> }
>>> } 
>>> On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:
>>>
 Can you include the full code after removing the buffers?
 Also try replacing flush() with close(). That might help.

 On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com wrote:

> I'm able to access all the websites on that IP from the device. I also 
> tried accessing the reply from the server without the BufferedInputStream 
> with no luck.
>
> The certificate I used was one I bought from bluehost.com who hosts 
> my server.
>
> On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:
>
>> With valid (not self signed) certificate?
>> Is it a publicly visible IP accessible from the device?
>>
>> On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> Yes, the site is https. To make sure, I tested it using the Qualys 
>>> ssl checker and I access it with the https:// prefix.
>>>
>>> --Dennis
>>> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>>>
 I meant the Rest class.

 Sorry I neglected to ask something basic. Is the URL HTTPS?
 If not iOS will fail by default. You can use this as a workaround: 
 https://www.codenameone.com/blog/ios-http-urls.html
 On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com 
 wrote:

> Yes I'm using codename1.io.URL.
>
> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:
>
>> Sorry but I'm still having problems. I tried using unbuffered IO 
>> but with the same result (works on the simulator but not on the 
>> device). 
>> Also the code I sent you was followed by:
>>
>> // Get buffered Input stream
>>
>> is = link.getInputStream();
>> BufferedInputStream binp = new BufferedInputStream(is);
>> // Get reply
>> String ans = readLine(binp);
>>
>> which I think would qualify as asking for a response from the 
>> server. BTW this is all being done on a separate thread.
>>
>> I'm learning about the REST protocol but think this should work.
>>
>> -Dennis
>> On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:
>>
>>> Are you using com.codenameone.io.URL ?
>>> I would recommend avoiding BufferedOutputStream in Codename One 
>>> as all streams are buffered by default in Codename One.
>>> You also need to fetch the result for the request to finish. It 
>>> won't happen until you try to get a response from the server.
>>>
>>> I would recommend using APIs like the "Rest" API which is 
>>> simpler to use and doesn't require threading.
>>>
>>> On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 
>>> a2nd...@gmail.com wrote:
>>>
 I have the following code that I use to send an email and 
 password to my server. It works fine on the simulator but fails on 
 an 
 actual iphone (I receive a blank email and password):

 try {
 URL url = new URL(*"server address"*);
 link = url.openConnection();
 link.setDoOutput(true);
 link.setDoInput(true);
 } catch(URISyntaxException e) {
 Log.p("URL 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-12 Thread Dennis Rogers
I switched to using Util.readToString() and still no joy on the iphone 
device.
The code still works ok on the simulator and on also on a real Android 
device.

On Wednesday, March 10, 2021 at 10:28:42 PM UTC-5 Shai Almog wrote:

> Try using String ans = Util.readToString(); which might be better. 
> Is the code still working on the simulator after the changes?
> Is it working on Android?
>
> On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com wrote:
>
>> Replacing flush() with close() didn't make a difference. Here's the code 
>> I used without the buffer:
>>
>> os = link.getOutputStream();
>> os.write((nemail + "\n").getBytes());
>> pwHash = getHash(nemail + npasswd);
>> os.write((pwHash + "\n").getBytes());
>> os.close();
>>
>> is = link.getInputStream();
>> String ans = readLine(is);
>>
>> static String readLine(InputStream stream) {
>> byte[] b = new byte[80];
>> String s = "";
>> int i = 0;
>> try {
>> b[i] = (byte) stream.read();
>> while((b[i] != 10 && (b[i] != 13))) {
>> i++;
>> b[i] = (byte) stream.read();
>> }
>> b[i] = 0;
>>return new String(b,0,i);
>> } catch(IOException e) {
>> Log.e(e);
>> return null:
>> }
>> } 
>> On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:
>>
>>> Can you include the full code after removing the buffers?
>>> Also try replacing flush() with close(). That might help.
>>>
>>> On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com wrote:
>>>
 I'm able to access all the websites on that IP from the device. I also 
 tried accessing the reply from the server without the BufferedInputStream 
 with no luck.

 The certificate I used was one I bought from bluehost.com who hosts my 
 server.

 On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:

> With valid (not self signed) certificate?
> Is it a publicly visible IP accessible from the device?
>
> On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com wrote:
>
>> Yes, the site is https. To make sure, I tested it using the Qualys 
>> ssl checker and I access it with the https:// prefix.
>>
>> --Dennis
>> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>>
>>> I meant the Rest class.
>>>
>>> Sorry I neglected to ask something basic. Is the URL HTTPS?
>>> If not iOS will fail by default. You can use this as a workaround: 
>>> https://www.codenameone.com/blog/ios-http-urls.html
>>> On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 Yes I'm using codename1.io.URL.

 On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:

> Sorry but I'm still having problems. I tried using unbuffered IO 
> but with the same result (works on the simulator but not on the 
> device). 
> Also the code I sent you was followed by:
>
> // Get buffered Input stream
>
> is = link.getInputStream();
> BufferedInputStream binp = new BufferedInputStream(is);
> // Get reply
> String ans = readLine(binp);
>
> which I think would qualify as asking for a response from the 
> server. BTW this is all being done on a separate thread.
>
> I'm learning about the REST protocol but think this should work.
>
> -Dennis
> On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:
>
>> Are you using com.codenameone.io.URL ?
>> I would recommend avoiding BufferedOutputStream in Codename One 
>> as all streams are buffered by default in Codename One.
>> You also need to fetch the result for the request to finish. It 
>> won't happen until you try to get a response from the server.
>>
>> I would recommend using APIs like the "Rest" API which is simpler 
>> to use and doesn't require threading.
>>
>> On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> I have the following code that I use to send an email and 
>>> password to my server. It works fine on the simulator but fails on 
>>> an 
>>> actual iphone (I receive a blank email and password):
>>>
>>> try {
>>> URL url = new URL(*"server address"*);
>>> link = url.openConnection();
>>> link.setDoOutput(true);
>>> link.setDoInput(true);
>>> } catch(URISyntaxException e) {
>>> Log.p("URL error");
>>> Log.e(e);
>>> }
>>> // Get buffered output stream
>>> os = link.getOutputStream();
>>> BufferedOutputStream bout = new BufferedOutputStream(os);
>>> // Send email and hashed Password
>>> bout.write((nemail + 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-10 Thread Shai Almog
Try using String ans = Util.readToString(); which might be better. 
Is the code still working on the simulator after the changes?
Is it working on Android?

On Wednesday, March 10, 2021 at 5:09:18 PM UTC+2 a2nd...@gmail.com wrote:

> Replacing flush() with close() didn't make a difference. Here's the code I 
> used without the buffer:
>
> os = link.getOutputStream();
> os.write((nemail + "\n").getBytes());
> pwHash = getHash(nemail + npasswd);
> os.write((pwHash + "\n").getBytes());
> os.close();
>
> is = link.getInputStream();
> String ans = readLine(is);
>
> static String readLine(InputStream stream) {
> byte[] b = new byte[80];
> String s = "";
> int i = 0;
> try {
> b[i] = (byte) stream.read();
> while((b[i] != 10 && (b[i] != 13))) {
> i++;
> b[i] = (byte) stream.read();
> }
> b[i] = 0;
>return new String(b,0,i);
> } catch(IOException e) {
> Log.e(e);
> return null:
> }
> } 
> On Tuesday, March 9, 2021 at 10:23:18 PM UTC-5 Shai Almog wrote:
>
>> Can you include the full code after removing the buffers?
>> Also try replacing flush() with close(). That might help.
>>
>> On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> I'm able to access all the websites on that IP from the device. I also 
>>> tried accessing the reply from the server without the BufferedInputStream 
>>> with no luck.
>>>
>>> The certificate I used was one I bought from bluehost.com who hosts my 
>>> server.
>>>
>>> On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:
>>>
 With valid (not self signed) certificate?
 Is it a publicly visible IP accessible from the device?

 On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com wrote:

> Yes, the site is https. To make sure, I tested it using the Qualys ssl 
> checker and I access it with the https:// prefix.
>
> --Dennis
> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>
>> I meant the Rest class.
>>
>> Sorry I neglected to ask something basic. Is the URL HTTPS?
>> If not iOS will fail by default. You can use this as a workaround: 
>> https://www.codenameone.com/blog/ios-http-urls.html
>> On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> Yes I'm using codename1.io.URL.
>>>
>>> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:
>>>
 Sorry but I'm still having problems. I tried using unbuffered IO 
 but with the same result (works on the simulator but not on the 
 device). 
 Also the code I sent you was followed by:

 // Get buffered Input stream

 is = link.getInputStream();
 BufferedInputStream binp = new BufferedInputStream(is);
 // Get reply
 String ans = readLine(binp);

 which I think would qualify as asking for a response from the 
 server. BTW this is all being done on a separate thread.

 I'm learning about the REST protocol but think this should work.

 -Dennis
 On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:

> Are you using com.codenameone.io.URL ?
> I would recommend avoiding BufferedOutputStream in Codename One as 
> all streams are buffered by default in Codename One.
> You also need to fetch the result for the request to finish. It 
> won't happen until you try to get a response from the server.
>
> I would recommend using APIs like the "Rest" API which is simpler 
> to use and doesn't require threading.
>
> On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> I have the following code that I use to send an email and 
>> password to my server. It works fine on the simulator but fails on 
>> an 
>> actual iphone (I receive a blank email and password):
>>
>> try {
>> URL url = new URL(*"server address"*);
>> link = url.openConnection();
>> link.setDoOutput(true);
>> link.setDoInput(true);
>> } catch(URISyntaxException e) {
>> Log.p("URL error");
>> Log.e(e);
>> }
>> // Get buffered output stream
>> os = link.getOutputStream();
>> BufferedOutputStream bout = new BufferedOutputStream(os);
>> // Send email and hashed Password
>> bout.write((nemail + "\n").getBytes());
>> pwHash = getHash(nemail + npasswd);
>> bout.write((pwHash + "\n").getBytes());
>> bout.flush();
>>
>> Thanks, Dennis
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from 

[codenameone-discussions] Re: Net Communications on iphone device

2021-03-09 Thread Shai Almog
Can you include the full code after removing the buffers?
Also try replacing flush() with close(). That might help.

On Tuesday, March 9, 2021 at 3:31:25 PM UTC+2 a2nd...@gmail.com wrote:

> I'm able to access all the websites on that IP from the device. I also 
> tried accessing the reply from the server without the BufferedInputStream 
> with no luck.
>
> The certificate I used was one I bought from bluehost.com who hosts my 
> server.
>
> On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:
>
>> With valid (not self signed) certificate?
>> Is it a publicly visible IP accessible from the device?
>>
>> On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> Yes, the site is https. To make sure, I tested it using the Qualys ssl 
>>> checker and I access it with the https:// prefix.
>>>
>>> --Dennis
>>> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>>>
 I meant the Rest class.

 Sorry I neglected to ask something basic. Is the URL HTTPS?
 If not iOS will fail by default. You can use this as a workaround: 
 https://www.codenameone.com/blog/ios-http-urls.html
 On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com wrote:

> Yes I'm using codename1.io.URL.
>
> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:
>
>> Sorry but I'm still having problems. I tried using unbuffered IO but 
>> with the same result (works on the simulator but not on the device). 
>> Also 
>> the code I sent you was followed by:
>>
>> // Get buffered Input stream
>>
>> is = link.getInputStream();
>> BufferedInputStream binp = new BufferedInputStream(is);
>> // Get reply
>> String ans = readLine(binp);
>>
>> which I think would qualify as asking for a response from the server. 
>> BTW this is all being done on a separate thread.
>>
>> I'm learning about the REST protocol but think this should work.
>>
>> -Dennis
>> On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:
>>
>>> Are you using com.codenameone.io.URL ?
>>> I would recommend avoiding BufferedOutputStream in Codename One as 
>>> all streams are buffered by default in Codename One.
>>> You also need to fetch the result for the request to finish. It 
>>> won't happen until you try to get a response from the server.
>>>
>>> I would recommend using APIs like the "Rest" API which is simpler to 
>>> use and doesn't require threading.
>>>
>>> On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com 
>>> wrote:
>>>
 I have the following code that I use to send an email and password 
 to my server. It works fine on the simulator but fails on an actual 
 iphone 
 (I receive a blank email and password):

 try {
 URL url = new URL(*"server address"*);
 link = url.openConnection();
 link.setDoOutput(true);
 link.setDoInput(true);
 } catch(URISyntaxException e) {
 Log.p("URL error");
 Log.e(e);
 }
 // Get buffered output stream
 os = link.getOutputStream();
 BufferedOutputStream bout = new BufferedOutputStream(os);
 // Send email and hashed Password
 bout.write((nemail + "\n").getBytes());
 pwHash = getHash(nemail + npasswd);
 bout.write((pwHash + "\n").getBytes());
 bout.flush();

 Thanks, Dennis

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/283048ae-20cd-414e-9005-6b593be3e2b6n%40googlegroups.com.


[codenameone-discussions] Re: Net Communications on iphone device

2021-03-09 Thread Dennis Rogers
I'm able to access all the websites on that IP from the device. I also 
tried accessing the reply from the server without the BufferedInputStream 
with no luck.

The certificate I used was one I bought from bluehost.com who hosts my 
server.

On Monday, March 8, 2021 at 9:51:04 PM UTC-5 Shai Almog wrote:

> With valid (not self signed) certificate?
> Is it a publicly visible IP accessible from the device?
>
> On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com wrote:
>
>> Yes, the site is https. To make sure, I tested it using the Qualys ssl 
>> checker and I access it with the https:// prefix.
>>
>> --Dennis
>> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>>
>>> I meant the Rest class.
>>>
>>> Sorry I neglected to ask something basic. Is the URL HTTPS?
>>> If not iOS will fail by default. You can use this as a workaround: 
>>> https://www.codenameone.com/blog/ios-http-urls.html
>>> On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com wrote:
>>>
 Yes I'm using codename1.io.URL.

 On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:

> Sorry but I'm still having problems. I tried using unbuffered IO but 
> with the same result (works on the simulator but not on the device). Also 
> the code I sent you was followed by:
>
> // Get buffered Input stream
>
> is = link.getInputStream();
> BufferedInputStream binp = new BufferedInputStream(is);
> // Get reply
> String ans = readLine(binp);
>
> which I think would qualify as asking for a response from the server. 
> BTW this is all being done on a separate thread.
>
> I'm learning about the REST protocol but think this should work.
>
> -Dennis
> On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:
>
>> Are you using com.codenameone.io.URL ?
>> I would recommend avoiding BufferedOutputStream in Codename One as 
>> all streams are buffered by default in Codename One.
>> You also need to fetch the result for the request to finish. It won't 
>> happen until you try to get a response from the server.
>>
>> I would recommend using APIs like the "Rest" API which is simpler to 
>> use and doesn't require threading.
>>
>> On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com 
>> wrote:
>>
>>> I have the following code that I use to send an email and password 
>>> to my server. It works fine on the simulator but fails on an actual 
>>> iphone 
>>> (I receive a blank email and password):
>>>
>>> try {
>>> URL url = new URL(*"server address"*);
>>> link = url.openConnection();
>>> link.setDoOutput(true);
>>> link.setDoInput(true);
>>> } catch(URISyntaxException e) {
>>> Log.p("URL error");
>>> Log.e(e);
>>> }
>>> // Get buffered output stream
>>> os = link.getOutputStream();
>>> BufferedOutputStream bout = new BufferedOutputStream(os);
>>> // Send email and hashed Password
>>> bout.write((nemail + "\n").getBytes());
>>> pwHash = getHash(nemail + npasswd);
>>> bout.write((pwHash + "\n").getBytes());
>>> bout.flush();
>>>
>>> Thanks, Dennis
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/58b128dd-2794-410e-bb5a-f05c7bd2a728n%40googlegroups.com.


[codenameone-discussions] Re: Net Communications on iphone device

2021-03-08 Thread Shai Almog
With valid (not self signed) certificate?
Is it a publicly visible IP accessible from the device?

On Monday, March 8, 2021 at 8:35:52 PM UTC+2 a2nd...@gmail.com wrote:

> Yes, the site is https. To make sure, I tested it using the Qualys ssl 
> checker and I access it with the https:// prefix.
>
> --Dennis
> On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:
>
>> I meant the Rest class.
>>
>> Sorry I neglected to ask something basic. Is the URL HTTPS?
>> If not iOS will fail by default. You can use this as a workaround: 
>> https://www.codenameone.com/blog/ios-http-urls.html
>> On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> Yes I'm using codename1.io.URL.
>>>
>>> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:
>>>
 Sorry but I'm still having problems. I tried using unbuffered IO but 
 with the same result (works on the simulator but not on the device). Also 
 the code I sent you was followed by:

 // Get buffered Input stream

 is = link.getInputStream();
 BufferedInputStream binp = new BufferedInputStream(is);
 // Get reply
 String ans = readLine(binp);

 which I think would qualify as asking for a response from the server. 
 BTW this is all being done on a separate thread.

 I'm learning about the REST protocol but think this should work.

 -Dennis
 On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:

> Are you using com.codenameone.io.URL ?
> I would recommend avoiding BufferedOutputStream in Codename One as all 
> streams are buffered by default in Codename One.
> You also need to fetch the result for the request to finish. It won't 
> happen until you try to get a response from the server.
>
> I would recommend using APIs like the "Rest" API which is simpler to 
> use and doesn't require threading.
>
> On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com 
> wrote:
>
>> I have the following code that I use to send an email and password to 
>> my server. It works fine on the simulator but fails on an actual iphone 
>> (I 
>> receive a blank email and password):
>>
>> try {
>> URL url = new URL(*"server address"*);
>> link = url.openConnection();
>> link.setDoOutput(true);
>> link.setDoInput(true);
>> } catch(URISyntaxException e) {
>> Log.p("URL error");
>> Log.e(e);
>> }
>> // Get buffered output stream
>> os = link.getOutputStream();
>> BufferedOutputStream bout = new BufferedOutputStream(os);
>> // Send email and hashed Password
>> bout.write((nemail + "\n").getBytes());
>> pwHash = getHash(nemail + npasswd);
>> bout.write((pwHash + "\n").getBytes());
>> bout.flush();
>>
>> Thanks, Dennis
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/938c9648-17f3-43f7-8b99-ebc2b7a5cc5fn%40googlegroups.com.


[codenameone-discussions] Re: Net Communications on iphone device

2021-03-08 Thread Dennis Rogers
Yes, the site is https. To make sure, I tested it using the Qualys ssl 
checker and I access it with the https:// prefix.

--Dennis
On Sunday, March 7, 2021 at 9:42:05 PM UTC-5 Shai Almog wrote:

> I meant the Rest class.
>
> Sorry I neglected to ask something basic. Is the URL HTTPS?
> If not iOS will fail by default. You can use this as a workaround: 
> https://www.codenameone.com/blog/ios-http-urls.html
> On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com wrote:
>
>> Yes I'm using codename1.io.URL.
>>
>> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:
>>
>>> Sorry but I'm still having problems. I tried using unbuffered IO but 
>>> with the same result (works on the simulator but not on the device). Also 
>>> the code I sent you was followed by:
>>>
>>> // Get buffered Input stream
>>>
>>> is = link.getInputStream();
>>> BufferedInputStream binp = new BufferedInputStream(is);
>>> // Get reply
>>> String ans = readLine(binp);
>>>
>>> which I think would qualify as asking for a response from the server. 
>>> BTW this is all being done on a separate thread.
>>>
>>> I'm learning about the REST protocol but think this should work.
>>>
>>> -Dennis
>>> On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:
>>>
 Are you using com.codenameone.io.URL ?
 I would recommend avoiding BufferedOutputStream in Codename One as all 
 streams are buffered by default in Codename One.
 You also need to fetch the result for the request to finish. It won't 
 happen until you try to get a response from the server.

 I would recommend using APIs like the "Rest" API which is simpler to 
 use and doesn't require threading.

 On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com 
 wrote:

> I have the following code that I use to send an email and password to 
> my server. It works fine on the simulator but fails on an actual iphone 
> (I 
> receive a blank email and password):
>
> try {
> URL url = new URL(*"server address"*);
> link = url.openConnection();
> link.setDoOutput(true);
> link.setDoInput(true);
> } catch(URISyntaxException e) {
> Log.p("URL error");
> Log.e(e);
> }
> // Get buffered output stream
> os = link.getOutputStream();
> BufferedOutputStream bout = new BufferedOutputStream(os);
> // Send email and hashed Password
> bout.write((nemail + "\n").getBytes());
> pwHash = getHash(nemail + npasswd);
> bout.write((pwHash + "\n").getBytes());
> bout.flush();
>
> Thanks, Dennis
>


-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/1b96d83d-c7b2-4629-af8c-0cf4599b99fbn%40googlegroups.com.


[codenameone-discussions] Re: Net Communications on iphone device

2021-03-07 Thread Shai Almog
I meant the Rest class.

Sorry I neglected to ask something basic. Is the URL HTTPS?
If not iOS will fail by default. You can use this as a workaround: 
https://www.codenameone.com/blog/ios-http-urls.html
On Sunday, March 7, 2021 at 7:13:46 PM UTC+2 a2nd...@gmail.com wrote:

> Yes I'm using codename1.io.URL.
>
> On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:
>
>> Sorry but I'm still having problems. I tried using unbuffered IO but with 
>> the same result (works on the simulator but not on the device). Also the 
>> code I sent you was followed by:
>>
>> // Get buffered Input stream
>>
>> is = link.getInputStream();
>> BufferedInputStream binp = new BufferedInputStream(is);
>> // Get reply
>> String ans = readLine(binp);
>>
>> which I think would qualify as asking for a response from the server. BTW 
>> this is all being done on a separate thread.
>>
>> I'm learning about the REST protocol but think this should work.
>>
>> -Dennis
>> On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:
>>
>>> Are you using com.codenameone.io.URL ?
>>> I would recommend avoiding BufferedOutputStream in Codename One as all 
>>> streams are buffered by default in Codename One.
>>> You also need to fetch the result for the request to finish. It won't 
>>> happen until you try to get a response from the server.
>>>
>>> I would recommend using APIs like the "Rest" API which is simpler to use 
>>> and doesn't require threading.
>>>
>>> On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com wrote:
>>>
 I have the following code that I use to send an email and password to 
 my server. It works fine on the simulator but fails on an actual iphone (I 
 receive a blank email and password):

 try {
 URL url = new URL(*"server address"*);
 link = url.openConnection();
 link.setDoOutput(true);
 link.setDoInput(true);
 } catch(URISyntaxException e) {
 Log.p("URL error");
 Log.e(e);
 }
 // Get buffered output stream
 os = link.getOutputStream();
 BufferedOutputStream bout = new BufferedOutputStream(os);
 // Send email and hashed Password
 bout.write((nemail + "\n").getBytes());
 pwHash = getHash(nemail + npasswd);
 bout.write((pwHash + "\n").getBytes());
 bout.flush();

 Thanks, Dennis

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/39b2e539-0810-451b-a100-caf02819c278n%40googlegroups.com.


[codenameone-discussions] Re: Net Communications on iphone device

2021-03-07 Thread Dennis Rogers
Yes I'm using codename1.io.URL.

On Sunday, March 7, 2021 at 11:46:23 AM UTC-5 Dennis Rogers wrote:

> Sorry but I'm still having problems. I tried using unbuffered IO but with 
> the same result (works on the simulator but not on the device). Also the 
> code I sent you was followed by:
>
> // Get buffered Input stream
>
> is = link.getInputStream();
> BufferedInputStream binp = new BufferedInputStream(is);
> // Get reply
> String ans = readLine(binp);
>
> which I think would qualify as asking for a response from the server. BTW 
> this is all being done on a separate thread.
>
> I'm learning about the REST protocol but think this should work.
>
> -Dennis
> On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:
>
>> Are you using com.codenameone.io.URL ?
>> I would recommend avoiding BufferedOutputStream in Codename One as all 
>> streams are buffered by default in Codename One.
>> You also need to fetch the result for the request to finish. It won't 
>> happen until you try to get a response from the server.
>>
>> I would recommend using APIs like the "Rest" API which is simpler to use 
>> and doesn't require threading.
>>
>> On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com wrote:
>>
>>> I have the following code that I use to send an email and password to my 
>>> server. It works fine on the simulator but fails on an actual iphone (I 
>>> receive a blank email and password):
>>>
>>> try {
>>> URL url = new URL(*"server address"*);
>>> link = url.openConnection();
>>> link.setDoOutput(true);
>>> link.setDoInput(true);
>>> } catch(URISyntaxException e) {
>>> Log.p("URL error");
>>> Log.e(e);
>>> }
>>> // Get buffered output stream
>>> os = link.getOutputStream();
>>> BufferedOutputStream bout = new BufferedOutputStream(os);
>>> // Send email and hashed Password
>>> bout.write((nemail + "\n").getBytes());
>>> pwHash = getHash(nemail + npasswd);
>>> bout.write((pwHash + "\n").getBytes());
>>> bout.flush();
>>>
>>> Thanks, Dennis
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/878825e8-f2d4-448b-9f42-27783015f00bn%40googlegroups.com.


[codenameone-discussions] Re: Net Communications on iphone device

2021-03-07 Thread Dennis Rogers
Sorry but I'm still having problems. I tried using unbuffered IO but with 
the same result (works on the simulator but not on the device). Also the 
code I sent you was followed by:

// Get buffered Input stream

is = link.getInputStream();
BufferedInputStream binp = new BufferedInputStream(is);
// Get reply
String ans = readLine(binp);

which I think would qualify as asking for a response from the server. BTW 
this is all being done on a separate thread.

I'm learning about the REST protocol but think this should work.

-Dennis
On Saturday, March 6, 2021 at 9:32:02 PM UTC-5 Shai Almog wrote:

> Are you using com.codenameone.io.URL ?
> I would recommend avoiding BufferedOutputStream in Codename One as all 
> streams are buffered by default in Codename One.
> You also need to fetch the result for the request to finish. It won't 
> happen until you try to get a response from the server.
>
> I would recommend using APIs like the "Rest" API which is simpler to use 
> and doesn't require threading.
>
> On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com wrote:
>
>> I have the following code that I use to send an email and password to my 
>> server. It works fine on the simulator but fails on an actual iphone (I 
>> receive a blank email and password):
>>
>> try {
>> URL url = new URL(*"server address"*);
>> link = url.openConnection();
>> link.setDoOutput(true);
>> link.setDoInput(true);
>> } catch(URISyntaxException e) {
>> Log.p("URL error");
>> Log.e(e);
>> }
>> // Get buffered output stream
>> os = link.getOutputStream();
>> BufferedOutputStream bout = new BufferedOutputStream(os);
>> // Send email and hashed Password
>> bout.write((nemail + "\n").getBytes());
>> pwHash = getHash(nemail + npasswd);
>> bout.write((pwHash + "\n").getBytes());
>> bout.flush();
>>
>> Thanks, Dennis
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/a10ab990-6563-41a2-ae5c-91ec7268c4e9n%40googlegroups.com.


[codenameone-discussions] Re: Net Communications on iphone device

2021-03-06 Thread Shai Almog
Are you using com.codenameone.io.URL ?
I would recommend avoiding BufferedOutputStream in Codename One as all 
streams are buffered by default in Codename One.
You also need to fetch the result for the request to finish. It won't 
happen until you try to get a response from the server.

I would recommend using APIs like the "Rest" API which is simpler to use 
and doesn't require threading.

On Saturday, March 6, 2021 at 11:24:53 PM UTC+2 a2nd...@gmail.com wrote:

> I have the following code that I use to send an email and password to my 
> server. It works fine on the simulator but fails on an actual iphone (I 
> receive a blank email and password):
>
> try {
> URL url = new URL(*"server address"*);
> link = url.openConnection();
> link.setDoOutput(true);
> link.setDoInput(true);
> } catch(URISyntaxException e) {
> Log.p("URL error");
> Log.e(e);
> }
> // Get buffered output stream
> os = link.getOutputStream();
> BufferedOutputStream bout = new BufferedOutputStream(os);
> // Send email and hashed Password
> bout.write((nemail + "\n").getBytes());
> pwHash = getHash(nemail + npasswd);
> bout.write((pwHash + "\n").getBytes());
> bout.flush();
>
> Thanks, Dennis
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/0ea5c29e-7e24-498b-ab55-99df69c2ea5an%40googlegroups.com.