RE: write failed with errno 11

"Oded Arbel" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
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, 1.3 KB)
--- gw/smsc_at2.c	2002-08-07 10:56:44.000000000 +0300
+++ gw/smsc_at2.c	2002-08-08 15:25:57.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,11 @@
     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);
+    do {
+	errno = 0;
+	s = write(privdata->fd, octstr_get_cstr(linestr), count);
+	++write_count;
+    } while (write_count < RETRY_SEND && s < 0 && errno == EAGAIN && gwthread_sleep(1));
     O_DESTROY(linestr);
     if (s < 0) {
         debug("bb.smsc.at2", 0, "AT2[%s]: write failed with errno %d", 
@@ -266,9 +271,14 @@
 {
     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);
+    do {
+	errno = 0;
+	s = write(privdata->fd, ctrlz, 1);
+	++write_count;
+    } while (write_count < RETRY_SEND && s < 0 && errno == EAGAIN && gwthread_sleep(1));
     if (s < 0) {
         debug("bb.smsc.at2", 0, "AT2[%s]: write failed with errno %d", 
               octstr_get_cstr(privdata->name), errno);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.