|
-
Reading File in .NET
I have a strange problem in my present project. I am creating a server in
VB.NET that accepts request from multiple clients. Each client passes a text
file to the server to read. There is no problem with the client code.
When I am reading the data from the text file in the server
Public Sub Main1(ByVal iJobNo As Integer)
Dim soc As Socket = tcpListener.AcceptSocket()
Try
Dim s As Stream = New NetworkStream(soc)
Dim sr As New StreamReader(s)
Dim sw As New StreamWriter(s)
sw.AutoFlush = True
Do
---PROBLEM LINE--- Dim name As String = sr.ReadLine()
If InStr(name, "*", CompareMethod.Text) = 3 Then
sUsrDetails(iJobNo) = name
Exit Do
End If
If name = "" Or name Is Nothing Then Exit Do
Loop
s.Close()
soc.Close()
End Sub
The streamReader(sr) sr.ReadLine() statement abruptly ends after it reads
the last line and does not go the verify the InStr method.
The text file is
//A9FRT1 JOB (A9FRT,AAIS),'TECHReports',CLASS=A,REGION=4M,MSGCLASS=Z,
// MSGLEVEL=(0,0),PASSWORD=HANDY
/*JOBPARM T=999,L=999
//LASER OUTPUT DEST=RMT10,FORMDEF=10FD,PAGEDEF=05PD
//PROC JCLLIB ORDER=AIS95.SISPROD.PROCLIB
//FOCUS1 EXEC FCSP,USEDBY=A2SYR,SYSTEM=PROD,NODE=95
//SYSPRINT DD SYSOUT=W
//OFFLINE DD SYSOUT=W,OUTPUT=*.LASER,
// DATACLAS=TTUFBA,DCB=(BLKSIZE=133)
//SYSIN DD *
EX FFR054 TERM_CYT=19991,
DEPT=HIST
FIN
/*
//
//*a9frt,handy,sathya76@yahoo.com,c:\temp\tempJCL.trd
The problem is it does work some time with the same code without any changes
being made.. but most other times it does not work.. this is strange though..
Pls let me know, if u can help me out here.. thanks in advance
Sathya
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks