yes you are correct its a problem at the python side. I tested with telnet and it seems it cannot send data.��

About your PS i am using isDataAvailable because I don't want the socket to go into a block mode, I want to just receive what already has become available to the socket. I tested with telnet and it works exactly as I want. That part of the code is too simple and probably will change in the future so its definitely not a final solution.��


On Sat, Jul 26, 2014 at 11:37 AM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
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 ?