Why the nodejs net socket does not send the data in the first connection?

0

Hello,

this is my code in lambda which runs based on SQS messages arrival.

var net = require('net'); let client = new net.Socket(); console.log(" ------------------- Attempt to connect... --------------------"); client.connect(port, 'ip', () => { console.log(" ------------------- Connected --------------------"); client.write(jsonres.raw_message); //This will send the byte buffer over TCP console.log(" ------------------- Message Sent! --------------------"); client.end(); console.log(" ------------------- Disconnected --------------------"); });

If I run this code from my PC it works but from AWS lambda I don't reach "connected" state. In the pcap I see the TCP init with 3 messages, SYN + SYN/ACK + ACK but no PSH/data. Why? If I send another message in short time I will get the first message in the serveer... It's like its on holding in AWS and just sent in the next connect... delay/Promise does not work. any idea?

1개 답변
0

solved by using function with callback. Tks to this page: https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html

답변함 10달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠