RE: write failed with errno 11
"Oded Arbel" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Here's an updated patch. this one should actually compile. it also has a rewritten handling of the SMS-SUBMIT flags, which includes support for the new rpi parameter (have no idea what it does) and for future handling of DLR messages. -- Oded Arbel m-Wise mobile solutions [email protected] +972-9-9581711 (116) +972-67-340014 ::.. When your life is a leaf that the seasons tear off and condemn They will bind you with love that is graceful and green as a stem. -- Leonard Cohen, "Sisters of Mercy" > -----Original Message----- > From: Oded Arbel > Sent: Thursday, August 08, 2002 2:30 PM > To: Stephane Pointu > Cc: [email protected] > Subject: RE: write failed with errno 11 > > > I'm less convinced now that its really necessary, but how > about this patch to AT2 ? > please - do not commit yet : I'm interested in comments on > the necessety of the patch and its correctness. I want to > submit a bigger patch later to address several AT2 issues. > > -- > Oded Arbel > m-Wise mobile solutions > [email protected] > > +972-9-9581711 (116) > +972-67-340014 > > ::.. > The earth is like a tiny grain of sand, only much, much heavier. > > > > > -----Original Message----- > > From: Oded Arbel > > Sent: Thursday, August 08, 2002 2:25 PM > > To: Stephane Pointu > > Cc: [email protected] > > Subject: RE: write failed with errno 11 > > > > > > > > > -----Original Message----- > > > From: Stephane Pointu [mailto:[email protected]] > > > Sent: Thursday, August 08, 2002 2:25 PM > > > To: Oded Arbel > > > Cc: [email protected] > > > Subject: RE: write failed with errno 11 > > > > > > > > > Thanks a lot. > > > > In the mean time you can try to increase the sendline-sleep > > in the modem configuration to something larger: this should > > also fix your problem. > > > > -- > > Oded Arbel > > m-Wise mobile solutions > > [email protected] > > > > +972-9-9581711 (116) > > +972-67-340014 > > > > ::.. > > Life is like arriving late for a movie, having to figure > out what was > > going on without bothering everybody with a lot of > questions, and then > > being unexpectedly called away before you find out how it ends. > > > > > > > > > > > > > > Stephane. > > > > > > -----Original Message----- > > > From: Oded Arbel [mailto:[email protected]] > > > Sent: 08 August 2002 14:18 > > > To: Stephane Pointu > > > Cc: [email protected] > > > Subject: RE: write failed with errno 11 > > > > > > > > > It looks like a problem with the iRDA connection beeing too > > > slow. I'll have > > > a fix for that later today. > > > > > > -- > > > Oded Arbel > > > m-Wise mobile solutions > > > [email protected] > > > > > > +972-9-9581711 (116) > > > +972-67-340014 > > > > > > ::.. > > > "Right now I'm having amnesia and deja vu at the same time - > > > I think I've > > > forgotten this before." > > > -- Stephen Wright > > > > > > > -----Original Message----- > > > > From: Stephane Pointu [mailto:[email protected]] > > > > Sent: Thursday, August 08, 2002 12:48 PM > > > > To: 'Stipe Tolj' > > > > Cc: [email protected] > > > > Subject: RE: write failed with errno 11 > > > > > > > > > > > > So, here is my config file: > > > > > > > > group = core > > > > admin-port = 13000 > > > > smsbox-port = 13001 > > > > wapbox-port = 9201 > > > > wdp-interface-name = "*" > > > > admin-password = ***** > > > > admin-deny-ip = "*.*.*.*" > > > > admin-allow-ip = "127.0.0.1;10.1.*.*" > > > > log-file = "/var/log/kannel/kannel.log" > > > > log-level = 0 > > > > box-deny-ip = "" > > > > box-allow-ip = "*.*.*.*" > > > > unified-prefix = "0033,0" > > > > access-log = "/var/log/kannel/access.log" > > > > > > > > # SMSC CONNECTIONS > > > > include = "/root/gateway-1.2.0/doc/modems.conf" > > > > group = smsc > > > > smsc = at2 > > > > smsc-id = T68 > > > > modemtype = ericsson_t68 > > > > device = /dev/ircomm0 > > > > speed = 19200 > > > > pin = 2345 > > > > > > > > # SMSBOX SETUP > > > > group = smsbox > > > > bearerbox-host = localhost > > > > sendsms-port = 13013 > > > > global-sender = 13013 > > > > log-file = "/var/log/kannel/smsbox.log" > > > > log-level = 0 > > > > > > > > # SEND-SMS USERS > > > > group = sendsms-user > > > > username = ******* > > > > password = ******* > > > > max-messages = 10 > > > > concatenation = true > > > > > > > > > > > > Here is my error message from bearerbox log: > > > > > > > > 2002-08-06 18:32:04 [14] DEBUG: boxc_receiver: sms received > > > > 2002-08-06 18:32:06 [5] DEBUG: AT2[T68]: international > > > > starting with 00 > > > > (0033666666666) > > > > 2002-08-06 18:32:06 [5] DEBUG: AT2[T68]: TP-Validity-Period: > > > > 24.0 hours > > > > 2002-08-06 18:32:06 [5] DEBUG: AT2[T68]: --> AT+CMGS=148^M > > > > 2002-08-06 18:32:06 [5] DEBUG: AT2[T68]: <-- > > > > > 2002-08-06 18:32:06 [5] DEBUG: AT2[T68]: send command status: 1 > > > > 2002-08-06 18:32:06 [5] DEBUG: AT2[T68]: --> > > > > 0051000B913366666666F60004A786060504C34FC002010604039481EA0001 > > > > 45C606018712FF > > > > 01871311030100000100010005000001871461018721110300080808080808 > > > > 08080800018722 > > > > 7001872311030000000000000187241103000000000000000000018728FF01 > > > > 87296B01018607 > > > > > > > > > > 110300000000000000000000000000010000000001C608018715110300000100010101 > > > > 2002-08-06 18:32:06 [5] DEBUG: AT2[T68]: --> ^Z > > > > 2002-08-06 18:32:06 [5] DEBUG: AT2[T68]: write failed > > with errno 11 > > > > > > > > > > > > And this is what i get in smsbox log: > > > > > > > > 2002-08-06 18:32:04 [2] DEBUG: HTTP: Creating HTTPClient for > > > > `127.0.0.1'. > > > > 2002-08-06 18:32:04 [3] INFO: smsbox: Got HTTP request > > > > </cgi-bin/sendsms> > > > > from < > > > > 127.0.0.1> > > > > 2002-08-06 18:32:04 [3] INFO: sendsms used by <*****> > > > > 2002-08-06 18:32:04 [3] INFO: sendsms > sender:<penguin:0677777777> > > > > (127.0.0.1) to > > > > :<0666666666> msg:<^A^F^D^C<94><81>ê> > > > > 2002-08-06 18:32:04 [3] DEBUG: message length 127, sending > > > 1 messages > > > > 2002-08-06 18:32:04 [3] DEBUG: Status: 202 Answer: <Sent.> > > > > 2002-08-06 18:32:04 [3] DEBUG: HTTP: Destroying HTTPClient > > > > area 0x80a0b88. > > > > 2002-08-06 18:32:04 [3] DEBUG: HTTP: Destroying HTTPClient > > > > for `127.0.0.1'. > > > > > > > > > > > > I run kannel 1.2.0 on a Redhat 7.3 Linux and use an Ericsson > > > > T68 via IRDA as > > > > SMSC. I have also tried kannel's daily snapshots and the > > > > problem was not > > > > solved. > > > > Does that help? I already talked about my problem in users > > > > mailing list and > > > > we could not find a solution. > > > > > > > > Thanks a lot for helping, > > > > Stephane. > > > > > > > > -----Original Message----- > > > > From: Stipe Tolj [mailto:[email protected]] > > > > Sent: 08 August 2002 12:33 > > > > To: Stephane Pointu > > > > Cc: [email protected] > > > > Subject: Re: write failed with errno 11 > > > > > > > > > > > > Stephane Pointu wrote: > > > > > > > > > > I have problems sending sms's longer than 125 characters. I > > > > get this error > > > > > message: > > > > > "write failed with errno 11" > > > > > > > > > > Can anybody tell me where i can change the code to split > > > > the sms in 125 > > > > > character long pieces. > > > > > > > > first of all, telling us what smsc type you use is > helpfull and an > > > > actual snapshot of the bearerbox and smsbox log would help too. > > > > > > > > Stipe > > > > > > > > [email protected] > > > > > > ------------------------------------------------------------------- > > > > Wapme Systems AG > > > > > > > > Vogelsanger Weg 80 > > > > 40470 Düsseldorf > > > > > > > > Tel: +49-211-74845-0 > > > > Fax: +49-211-74845-299 > > > > > > > > E-Mail: [email protected] > > > > Internet: http://www.wapme-systems.de > > > > > > ------------------------------------------------------------------- > > > > wapme.net - wherever you are > > > > > > > > > > > > > > > >
smsc_at2.patch
(application/octet-stream, 2.3 KB)
--- gw/smsc_at2.c 2002-08-07 10:56:44.000000000 +0300
+++ gw/smsc_at2.c 2002-08-08 15:46:56.000000000 +0300
@@ -241,6 +241,7 @@
{
int count;
int s = 0;
+ int write_count = 0;
Octstr *linestr = NULL;
linestr = octstr_format("%s\r", line);
@@ -248,7 +249,15 @@
debug("bb.smsc.at2", 0, "AT2[%s]: --> %s^M", octstr_get_cstr(privdata->name), line);
count = octstr_len(linestr);
- s = write(privdata->fd, octstr_get_cstr(linestr), count);
+ while (1) {
+ errno = 0;
+ s = write(privdata->fd, octstr_get_cstr(linestr), count);
+ if (s < 0 && errno == EAGAIN && write_count < RETRY_SEND) {
+ gwthread_sleep(1);
+ ++write_count;
+ } else
+ break;
+ };
O_DESTROY(linestr);
if (s < 0) {
debug("bb.smsc.at2", 0, "AT2[%s]: write failed with errno %d",
@@ -266,9 +275,18 @@
{
int s;
char *ctrlz = "\032" ;
-
+ int write_count = 0;
+
debug("bb.smsc.at2", 0, "AT2[%s]: --> ^Z", octstr_get_cstr(privdata->name));
- s = write(privdata->fd, ctrlz, 1);
+ while (1) {
+ errno = 0;
+ s = write(privdata->fd, ctrlz, 1);
+ if (s < 0 && errno == EAGAIN && write_count < RETRY_SEND) {
+ gwthread_sleep(1);
+ ++write_count;
+ } else
+ break;
+ };
if (s < 0) {
debug("bb.smsc.at2", 0, "AT2[%s]: write failed with errno %d",
octstr_get_cstr(privdata->name), errno);
@@ -1517,14 +1612,18 @@
*/
/*
- * message type SUBMIT
- * 01010001 = 0x51 indicating add. UDH, TP-VP(Rel) & MSG_SUBMIT
- * or 00010001 = 0x11 for just TP-VP(Rel) & MSG_SUBMIT
+ * message type SUBMIT , bit mapped :
+ * bit7 .. bit0
+ * TP-RP , TP-UDHI, TP-SRR, TP-VPF(4), TP-VPF(3), TP-RD, TP-MTI(1), TP-MTI(0)
*/
-
- pdu[pos] = octstr_len(msg->sms.udhdata) ? at2_numtext(5) : at2_numtext(1);
+ i = (msg->sms.rpi > 0) << 7 /* TP-RP */
+ & (octstr_len(msg->sms.udhdata) > 0) << 6 /* TP-UDHI */
+ & ((msg->sms.dlr_mask & (DLR_SUCCESS | DLR_FAIL | DLR_BUFFERED)) > 0) << 5 /* TP-SRR */
+ & 16 /* TP-VP(Rel)*/
+ & 1; /* TP-MTI: SUBMIT_SM */
+ pdu[pos] = at2_numtext(i >> 4);
pos++;
- pdu[pos] = at2_numtext(AT_SUBMIT_SM);
+ pdu[pos] = at2_numtext(i & 15);
pos++;
/* message reference (0 for now) */