Originally Posted by Wims
Of course not, as 1) it's not working as you want it to, the ultimate way to tell it's not "like this" no, and 2) you didn't listen to what I said.
You're not reading the data by using /sockread inside the on sockread event, I even gave you a full example of line by line reading which you completely ignored, so there you go, no more example for you.

Dude.. relax. I'm sorry, I made a mistake by not copying the right actual code. I used your example:
Code
alias user {
    var %username = $1
    var %json = $+({ "username": " %username " })
    var %header = POST /user HTTP/1.1 $+ $crlf $+ Host: localhost $+ $crlf $+ Content-Type: application/json $+ $crlf $+ Content-Length: $+ $len(%json) $+ $crlf $+ $crlf
    var %request = %header $+ %json

    echo -a Send request: %request
    sockopen mysocket localhost 3000
    sockmark mysocket %request
}

on *:SOCKOPEN:mysocket: {
    if ($sockerr) return
    sockwrite -nt $sockname $gettok($sock($sockname).mark,1-,$crlf)
}

on *:SOCKREAD:mysocket: {
if ($sockerr) return
var %read
sockread %read
if ($sockbr == 0) return
;a line is guarantee to be in %read at this point but can be empty line of course.
echo -ag > %read
}

Also please note.. I'm a complete noob at mIRC coding. This now results in a 400 Bad request response:
Code
Send request: POST /user HTTP/1.1
Host: localhost
Content-Type: application/json
Content-Length:25

{ "username": " jaghj " }
> HTTP/1.1 400 Bad Request
> Connection: close
>

I would really appreciate it if you would give me another chance smile

Originally Posted by atomic10
Code
if ($length(%data)

Did you mean $len(%data) in the SOCKREAD Event?

Maybe. Tried this, then returns with the error (An error occurred while retrieving data for user) - so empty data again...