Kilon,
I can't see any direct error in your code (on the client side, I don't known about the server).
Consider this (do it):
| stream |
stream := SocketStream openConnectionToHostNamed: 'zn.stfx.eu' port: 80.
stream sendCommand: 'GET / HTTP1.1', String crlf.
stream upToEnd inspect .
stream close.
Client-side TCP is pretty simple. #sendCommand: does a #flush after adding a CRLF (we need two here).
HTH,
Sven
PS: There is no need to do #isDataAvailable, reading a socket stream blocks while waiting for data (within the timeout).
On 26 Jul 2014, at 01:04, kilon alios <kilon.alios@gmail.com> wrote:
> so I have no issues sending data from pharo to python but I have a problem recieving data from python
>
> here is my method
>
> sendMessage: aString
>
> |stream errString isDataAvailable |
> stream := SocketStream openConnectionToHostNamed: '127.0.0.1' ��port: 4000 .
> stream sendCommand: aString.
> isDataAvailable := stream isDataAvailable .
> isDataAvailable inspect.
> isDataAvailable ifTrue: [ errString := stream nextLineCrLf ��.
> �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� errString inspect.
> �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� ��errString = '' ifFalse:
> �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� �� [self error: errString.]] .
>
> stream close.
>
>
> I have used telnet to test the connection , telnet can receive the data fine and it displays it fine. I have encode the data as bytestring from python with ascii encoding and added both a carriage return and a line feed in the end ? whats wrong ?
>
> I tried most method in socket stream even upToEnd message and none gives back any data.
>
> What am I doing wrong ?