Android Question unexpected end of stream on okhttp3

Discussion in 'Android Questions' started by xmtotti, Apr 8, 2019.

Tags:
  1. xmtotti

    xmtotti Member Licensed User

    Hi,when I connect web service has a error :unexpected end of stream on okhttp3.Address@c1d37c3f
    how I can resolve thanks
    Code:
    Sub zx1_scan_result (scantext As String, scanformat As String)       
        
    Log ("B4A scan text = " & scantext)
        
    Log ("B4A scan format = " & scanformat)
        b3_Click
        Sleep(
    10)
        
    Dim rtnmsg,epurl As String
        
    Dim parm As String
        
    Dim job1 As HttpJob
        
    Dim str() As String
        job1.Initialize(
    "job1",Me)
        epurl=
    "http://zhzk.xipc.com.cn:8902/EIR.asmx"
        parm=
    "securityKey=D0EA5FC3BA214476A8288271A70291EF&CorpCode=913502007760244992&EIRNo="&scantext
        
    Log(parm)   
        
    'job1.PostString(epurl&"/GetEirInfo",parm)   
        job1.PatchString(epurl&"/GetEirInfo",parm)
        
    Wait For (job1) JobDone(job1 As HttpJob)
        rtnmsg=
    "请重试"
        
    If job1.Success Then
            rtnmsg=JobDone(job1)
            
    Log(rtnmsg)
            
    If rtnmsg.SubString2(0,2)="OK" Then
                str=
    Regex.split("@",rtnmsg)
                
    For i=1 To str.Length -1
                    
    Log(str(i))
                
    Next
            
    Else
                
    Msgbox(rtnmsg,"提示")
            
    End If
        
    Else
            
    Msgbox(rtnmsg,"提示")
        
    End If
    End Sub

    Sub JobDone (Job As HttpJobAs String
        
    Dim rtnmsg As String
        
    Dim str() As String
        
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)   
        
    If Job.Success = True Then
            rtnmsg=app_public.xml_parse(Job.GetString)
            
    Log(rtnmsg)
            str=
    Regex.split("@",rtnmsg)
            Job.Release
            
    Return rtnmsg
        
    Else
            
    'Log("Error: " & Job.ErrorMessage)
            ToastMessageShow("Error: " & Job.ErrorMessage, True)
            Job.Release
            
    Return "请重试"&Job.ErrorMessage
        
    End If   
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Never use Msgbox. Especially not for debugging. Use Log instead.

    Can you post the full error message from the logs?
     
  3. xmtotti

    xmtotti Member Licensed User

    Hi,Erel,pls see the pic
    upload_2019-4-8_21-50-20.png
     
  4. OliverA

    OliverA Expert Licensed User

    1) The code in post#1 and post#3 is not the some
    Post #1:
    Code:
    epurl="http://zhzk.xipc.com.cn:8902/EIR.asmx"
    'some more code
    job1.PatchString(epurl&"/GetEirInfo",parm)
    This, you your example creates a URL of
    Somehow I don't think this is right (guessing).
    Another guess here is that you are trying to access the API of a website, but you have no clue as to what that API requires from you. You used PostString, PatchString, and Head (in post #3) to access the site (my guess, neither PatchString nor Head is correct, nor the URL you are building). You need to provide us with the sites API documentation before your issue can be resolved (right now, you are getting IOException errors due to improper calling of the sites API, again a guess).
    Note: Don't post a screenshot of the error message, just post the text. Right-clicking on the error message should give you the "Copy line to clipboard". Use that to post the error message as text in the forum.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice