Probably has again to do with endofline. If the server runs on Windows and the client runs on a Mac, the expected endoflines are different.
Real machine, and yep ping ok.
The client send button is enabled on entry.
In the next few days i hope to get a basic4android version up and going as well.
Can I make it to work with both, or do I need different versions for both.
what if the server is a Mac and client a PC or even an Android (using B4A)
Tom
Change both the client & the server to use ChrB(26) as the terminator. This in the old days was end-of-file. You can use + Z to emulate this when using Telnet.
Thanks so much for that will give it a test.
BTW might that fix the blob field that I tested but did not work?
No, if you want to transfer blobs you’ll need to use encodehex for that column at the server & decodehex at the client.
I’d just like to make this plain to anyone looking here - this project is a demo of the power of Xojo. If it were ever to make it to the wild there would be chaos - there is absolutely no security on access and no reasonable expectation that this could be added without significant cost.
Point taken.
As it is now, it would only be Intranet, is that correct?
Tom
And works like a charm from the PC as a server and Client as the mac.
Intranet only.
Tom
On an Intranet there’s a reasonable expectation of security, however with BYOD you can never be sure.
Tom I’d never use this code commercially, it was always just a hack to show the power & ease of using Xojo.
Point taken.
Will only be used in-house.
And thanks again for your help.
BTW works like a charm with the PC as a server and Mac as the client.
Tom
Have added blowfish encoding now. Works well.
For multiple connections do I need a separate socket on the server side for each connection?
If so how do I implement this.
Maybe have a few connections listening. Am at a loss.
Tom
Have a look at ServerSocket. It basically listens on the selected port and then “hands-off” the connection to one of a pool of TCPSockets.
Thanks I will. Do I still only use 1 port?
Thanks Wayne,
Works like a charm I think.
Did some copying and pasting from the demo.
Will check some more now.
Tom
Hi All and I hope Wayne,
I am still using Wayne’s Json Client Server.
I have added to the sqlite database and have some Date Fields.
Some of these are nil, I have not given all the Date fields a value.
When I run the server I get an error when I try and get all the fields from a record.
The error is
Exception Message: Unrecognized Object: 0
Exception Error Number: 11
This is set on
Return Result.ToString
I assume this is because of a nill object.
How can I catch this or do I have to set all dates to a specific value?
When I insert into the database I first check if the object is nil then I don’t include that field.
I would love to do that on the sending side.
Tom
Hi Tom
You can test if the field is Nil with “.value Is Nil”
Cheers
Wayne
mm.
Tried that and got errors.
Have done this…
Dim rst As RecordSet = MyDatabase.SQLSelect(rs.Value("sql"))
Dim Result As New JSONItem
If MyDatabase.Error Then
Result.Value("Error") = True
Result.Value("ErrorMessage") = MyDatabase.ErrorMessage
Else
Result.Value("Error") = False
Dim jRecordSet As New JSONItem
If rst = Nil Then ' rst will be nil if the Request wasn't a query
Else
Do Until rst.EOF
Dim js As New JSONItem
For i = 1 To rst.FieldCount
if rst.IdxField(i).Name = "image" then
js.Value(rst.IdxField(i).Name) = encodebase64(rst.IdxField(i).Value)
else
if rst.ColumnType(i)=8 then // Date
dim d1 as new Date
if rst.Field(rst.IdxField(i).Name).DateValue = nil then
d.Year = 1949
js.Value(rst.IdxField(i).Name) = d.SQLDate
else
js.Value(rst.IdxField(i).Name) = rst.IdxField(i).Value
end if
else
js.Value(rst.IdxField(i).Name) = rst.IdxField(i).Value
end If
end if
Next i
jRecordSet.Append js
rst.MoveNext
Loop
End If
but get a unsupported value here
if rst.Field(rst.IdxField(i).Name).DateValue = nil then
Only happens on Date field
strange though.
I did another test to see if would work…
if rs.ColumnType(7)=8 then
if rs.Field("lastupdate").DateValue <> nil then
d = rs.Field("lastupdate").DateValue
label1.Text = d.ShortDate
end if
end if
And no exception happens.
bugger.
Just changed the ColumnType to i-1 and it passed that
but came up with another error
Unrecognized Object: 0
Maybe it is the Currency being null as well.
Will check