W5100 TCP Server: How to Receive Data (byte) Coreectly?
Dave D'Amato
Posts: 6
Hey all,
Ok, here we go...
First off I have tried various samples/spin object demo's/searched the forums/read etc... and I still can't get this right.... lol!
Using a prop spin P8x32A interfaced using the WIZ812MJ network module for TCP/IP Server - Client communications.
Using W5100_SPI_Driver.
The prop/WIZ812MJ network module serves as the Server.
Using VB Winsock for the client side.
For the most part, all setup communications, IP/Sub/Gateway addressing good, connect, send.data, DataArrival and A/D field measurement data (bytes & string) is being received at the client side netwroked computer with no issues. All good.
Where I'm getting stuck is where I need to remotely change stored variable settings, IP/Sub/Gatewya Addressing, A/D Threshold byte settings etc...back in the Prop Server.
For the time being, only trying to receive one byte from the client (computer VB Winsock), and Serial Terminal print the received byte...
This is where it goes weird....
Client side VB Winsock:
txtsend = byte 192 .....for example
Winsock.SendData txtsend
Extracted from the "Spinnerete_TCP_Client_Demo.spin"
Have tried various configurations of this, still no luck.
VAR
BYTE text[8192]
LONG len
OBJ
TCP : "Spinneret_Simple_TCP"
PST : "Parallax Serial Terminal"
if TCP.Connect(pertinent info correct) = true
' Receive and display text until connection is lost
repeat while TCP.isConnected(0)
len:=TCP.RecvStr(0, @text)
if len > 0
PST.Str(@text)
PST.Str(String("Closing socket...", 13))
TCP.Close(0)
else
PST.Str(String("Could not connect..."))
Server Serial Terminal Results...
Connection established.
Waiting for TCP data.
Read 1 bytes from TCP
PST.Str(@text) displays this..... 21071 21072 21073 21074 21075 21076
SO the byte came in fine but not the expected data 192 byte....
Ideas...?
Thanks in advance,
Dave
Ok, here we go...
First off I have tried various samples/spin object demo's/searched the forums/read etc... and I still can't get this right.... lol!
Using a prop spin P8x32A interfaced using the WIZ812MJ network module for TCP/IP Server - Client communications.
Using W5100_SPI_Driver.
The prop/WIZ812MJ network module serves as the Server.
Using VB Winsock for the client side.
For the most part, all setup communications, IP/Sub/Gateway addressing good, connect, send.data, DataArrival and A/D field measurement data (bytes & string) is being received at the client side netwroked computer with no issues. All good.
Where I'm getting stuck is where I need to remotely change stored variable settings, IP/Sub/Gatewya Addressing, A/D Threshold byte settings etc...back in the Prop Server.
For the time being, only trying to receive one byte from the client (computer VB Winsock), and Serial Terminal print the received byte...
This is where it goes weird....
Client side VB Winsock:
txtsend = byte 192 .....for example
Winsock.SendData txtsend
Extracted from the "Spinnerete_TCP_Client_Demo.spin"
Have tried various configurations of this, still no luck.
VAR
BYTE text[8192]
LONG len
OBJ
TCP : "Spinneret_Simple_TCP"
PST : "Parallax Serial Terminal"
if TCP.Connect(pertinent info correct) = true
' Receive and display text until connection is lost
repeat while TCP.isConnected(0)
len:=TCP.RecvStr(0, @text)
if len > 0
PST.Str(@text)
PST.Str(String("Closing socket...", 13))
TCP.Close(0)
else
PST.Str(String("Could not connect..."))
Server Serial Terminal Results...
Connection established.
Waiting for TCP data.
Read 1 bytes from TCP
PST.Str(@text) displays this..... 21071 21072 21073 21074 21075 21076
SO the byte came in fine but not the expected data 192 byte....
Ideas...?
Thanks in advance,
Dave
Comments
Fire it up, DHCP will take over and assign your network parameters. Make sure you have the Parallax Serial Terminal open once the code loads so you can see the assigned IP etc. Then Simply open a browser and enter the IP shown in the serial terminal. You'll see a bunch of bytes fly on the screen, the HTTP header.
Next, enter your IP and a simple query string to see PIN 0's register values.
ie. http:/ / 192. 168. 1. 113/pinstate.xml?led=0&value=-1
You can find a ton of information in the Spinneret forum.
If the byes still do not show up correctly then you might have a bug in your socket program or a configuration issue.
Try it yourself...
http://spinneret.servebeer.com:8080
http://spinneret.servebeer.com:8080/pinstate.xml?led=23&value=0
Yeah I've read through the Servebeer.com but not really what I was looking for. In this project design I'm working on, I need to be able to install the parallax/network modules at different locations throughout the country with the ability for TCP/IP networking, remote live feed observations of input measurements, user insert of networking addressing/configurations while on location (no brainer) and the ability to change threshold settings as required....
Noticed some differences/addtions in your W5100 spin, will give them a go and post the results...
Thanks again!
Dave
http://spinneret.servebeer.com:8080/epin.htm